2802 int uncommon_trap_offset = 0;
2803
2804 if (EnableJVMCI) {
2805 implicit_exception_uncommon_trap_offset = __ pc() - start;
2806
2807 __ pushptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())));
2808 __ movptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())), (int32_t)NULL_WORD);
2809
2810 uncommon_trap_offset = __ pc() - start;
2811
2812 // Save everything in sight.
2813 RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words);
2814 // fetch_unroll_info needs to call last_java_frame()
2815 __ set_last_Java_frame(noreg, noreg, NULL);
2816
2817 __ movl(c_rarg1, Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())));
2818 __ movl(Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())), -1);
2819
2820 __ movl(r14, (int32_t)Deoptimization::Unpack_reexecute);
2821 __ mov(c_rarg0, r15_thread);
2822 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
2823 oop_maps->add_gc_map( __ pc()-start, map->deep_copy());
2824
2825 __ reset_last_Java_frame(false, false);
2826
2827 __ jmp(after_fetch_unroll_info_call);
2828 } // EnableJVMCI
2829 #endif // INCLUDE_JVMCI
2830
2831 int exception_offset = __ pc() - start;
2832
2833 // Prolog for exception case
2834
2835 // all registers are dead at this entry point, except for rax, and
2836 // rdx which contain the exception oop and exception pc
2837 // respectively. Set them in TLS and fall thru to the
2838 // unpack_with_exception_in_tls entry point.
2839
2840 __ movptr(Address(r15_thread, JavaThread::exception_pc_offset()), rdx);
2841 __ movptr(Address(r15_thread, JavaThread::exception_oop_offset()), rax);
2888
2889 // Call C code. Need thread and this frame, but NOT official VM entry
2890 // crud. We cannot block on this call, no GC can happen.
2891 //
2892 // UnrollBlock* fetch_unroll_info(JavaThread* thread)
2893
2894 // fetch_unroll_info needs to call last_java_frame().
2895
2896 __ set_last_Java_frame(noreg, noreg, NULL);
2897 #ifdef ASSERT
2898 { Label L;
2899 __ cmpptr(Address(r15_thread,
2900 JavaThread::last_Java_fp_offset()),
2901 (int32_t)0);
2902 __ jcc(Assembler::equal, L);
2903 __ stop("SharedRuntime::generate_deopt_blob: last_Java_fp not cleared");
2904 __ bind(L);
2905 }
2906 #endif // ASSERT
2907 __ mov(c_rarg0, r15_thread);
2908 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info)));
2909
2910 // Need to have an oopmap that tells fetch_unroll_info where to
2911 // find any register it might need.
2912 oop_maps->add_gc_map(__ pc() - start, map);
2913
2914 __ reset_last_Java_frame(false, false);
2915
2916 #if INCLUDE_JVMCI
2917 if (EnableJVMCI) {
2918 __ bind(after_fetch_unroll_info_call);
2919 }
2920 #endif
2921
2922 // Load UnrollBlock* into rdi
2923 __ mov(rdi, rax);
2924
2925 Label noException;
2926 __ cmpl(r14, Deoptimization::Unpack_exception); // Was exception pending?
2927 __ jcc(Assembler::notEqual, noException);
2928 __ movptr(rax, Address(r15_thread, JavaThread::exception_oop_offset()));
2929 // QQQ this is useless it was NULL above
2930 __ movptr(rdx, Address(r15_thread, JavaThread::exception_pc_offset()));
2931 __ movptr(Address(r15_thread, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD);
2932 __ movptr(Address(r15_thread, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD);
2933
2934 __ verify_oop(rax);
2935
2936 // Overwrite the result registers with the exception results.
2937 __ movptr(Address(rsp, RegisterSaver::rax_offset_in_bytes()), rax);
2938 // I think this is useless
2939 __ movptr(Address(rsp, RegisterSaver::rdx_offset_in_bytes()), rdx);
2940
2941 __ bind(noException);
2942
2943 // Only register save data is on the stack.
2944 // Now restore the result registers. Everything else is either dead
3123 // stack, so rsp is 8-byte aligned until we allocate our frame.
3124 __ subptr(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Epilog!
3125
3126 // No callee saved registers. rbp is assumed implicitly saved
3127 __ movptr(Address(rsp, SimpleRuntimeFrame::rbp_off << LogBytesPerInt), rbp);
3128
3129 // compiler left unloaded_class_index in j_rarg0 move to where the
3130 // runtime expects it.
3131 __ movl(c_rarg1, j_rarg0);
3132
3133 __ set_last_Java_frame(noreg, noreg, NULL);
3134
3135 // Call C code. Need thread but NOT official VM entry
3136 // crud. We cannot block on this call, no GC can happen. Call should
3137 // capture callee-saved registers as well as return values.
3138 // Thread is in rdi already.
3139 //
3140 // UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index);
3141
3142 __ mov(c_rarg0, r15_thread);
3143 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
3144
3145 // Set an oopmap for the call site
3146 OopMapSet* oop_maps = new OopMapSet();
3147 OopMap* map = new OopMap(SimpleRuntimeFrame::framesize, 0);
3148
3149 // location of rbp is known implicitly by the frame sender code
3150
3151 oop_maps->add_gc_map(__ pc() - start, map);
3152
3153 __ reset_last_Java_frame(false, false);
3154
3155 // Load UnrollBlock* into rdi
3156 __ mov(rdi, rax);
3157
3158 // Pop all the frames we must move/replace.
3159 //
3160 // Frame picture (youngest to oldest)
3161 // 1: self-frame (no frame link)
3162 // 2: deopting frame (no frame link)
3163 // 3: caller of deopting frame (could be compiled/interpreted).
3164
3165 // Pop self-frame. We have no frame, and must rely only on rax and rsp.
3166 __ addptr(rsp, (SimpleRuntimeFrame::framesize - 2) << LogBytesPerInt); // Epilog!
3167
3168 // Pop deoptimized frame (int)
3169 __ movl(rcx, Address(rdi,
3170 Deoptimization::UnrollBlock::
3171 size_of_deoptimized_frame_offset_in_bytes()));
3172 __ addptr(rsp, rcx);
3173
3174 // rsp should be pointing at the return address to the caller (3)
3175
3176 // Pick up the initial fp we should save
|
2802 int uncommon_trap_offset = 0;
2803
2804 if (EnableJVMCI) {
2805 implicit_exception_uncommon_trap_offset = __ pc() - start;
2806
2807 __ pushptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())));
2808 __ movptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())), (int32_t)NULL_WORD);
2809
2810 uncommon_trap_offset = __ pc() - start;
2811
2812 // Save everything in sight.
2813 RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words);
2814 // fetch_unroll_info needs to call last_java_frame()
2815 __ set_last_Java_frame(noreg, noreg, NULL);
2816
2817 __ movl(c_rarg1, Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())));
2818 __ movl(Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())), -1);
2819
2820 __ movl(r14, (int32_t)Deoptimization::Unpack_reexecute);
2821 __ mov(c_rarg0, r15_thread);
2822 __ movl(c_rarg2, r14); // exec mode
2823 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
2824 oop_maps->add_gc_map( __ pc()-start, map->deep_copy());
2825
2826 __ reset_last_Java_frame(false, false);
2827
2828 __ jmp(after_fetch_unroll_info_call);
2829 } // EnableJVMCI
2830 #endif // INCLUDE_JVMCI
2831
2832 int exception_offset = __ pc() - start;
2833
2834 // Prolog for exception case
2835
2836 // all registers are dead at this entry point, except for rax, and
2837 // rdx which contain the exception oop and exception pc
2838 // respectively. Set them in TLS and fall thru to the
2839 // unpack_with_exception_in_tls entry point.
2840
2841 __ movptr(Address(r15_thread, JavaThread::exception_pc_offset()), rdx);
2842 __ movptr(Address(r15_thread, JavaThread::exception_oop_offset()), rax);
2889
2890 // Call C code. Need thread and this frame, but NOT official VM entry
2891 // crud. We cannot block on this call, no GC can happen.
2892 //
2893 // UnrollBlock* fetch_unroll_info(JavaThread* thread)
2894
2895 // fetch_unroll_info needs to call last_java_frame().
2896
2897 __ set_last_Java_frame(noreg, noreg, NULL);
2898 #ifdef ASSERT
2899 { Label L;
2900 __ cmpptr(Address(r15_thread,
2901 JavaThread::last_Java_fp_offset()),
2902 (int32_t)0);
2903 __ jcc(Assembler::equal, L);
2904 __ stop("SharedRuntime::generate_deopt_blob: last_Java_fp not cleared");
2905 __ bind(L);
2906 }
2907 #endif // ASSERT
2908 __ mov(c_rarg0, r15_thread);
2909 __ movl(c_rarg1, r14); // exec_mode
2910 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info)));
2911
2912 // Need to have an oopmap that tells fetch_unroll_info where to
2913 // find any register it might need.
2914 oop_maps->add_gc_map(__ pc() - start, map);
2915
2916 __ reset_last_Java_frame(false, false);
2917
2918 #if INCLUDE_JVMCI
2919 if (EnableJVMCI) {
2920 __ bind(after_fetch_unroll_info_call);
2921 }
2922 #endif
2923
2924 // Load UnrollBlock* into rdi
2925 __ mov(rdi, rax);
2926
2927 __ movl(r14, Address(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()));
2928 Label noException;
2929 __ cmpl(r14, Deoptimization::Unpack_exception); // Was exception pending?
2930 __ jcc(Assembler::notEqual, noException);
2931 __ movptr(rax, Address(r15_thread, JavaThread::exception_oop_offset()));
2932 // QQQ this is useless it was NULL above
2933 __ movptr(rdx, Address(r15_thread, JavaThread::exception_pc_offset()));
2934 __ movptr(Address(r15_thread, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD);
2935 __ movptr(Address(r15_thread, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD);
2936
2937 __ verify_oop(rax);
2938
2939 // Overwrite the result registers with the exception results.
2940 __ movptr(Address(rsp, RegisterSaver::rax_offset_in_bytes()), rax);
2941 // I think this is useless
2942 __ movptr(Address(rsp, RegisterSaver::rdx_offset_in_bytes()), rdx);
2943
2944 __ bind(noException);
2945
2946 // Only register save data is on the stack.
2947 // Now restore the result registers. Everything else is either dead
3126 // stack, so rsp is 8-byte aligned until we allocate our frame.
3127 __ subptr(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Epilog!
3128
3129 // No callee saved registers. rbp is assumed implicitly saved
3130 __ movptr(Address(rsp, SimpleRuntimeFrame::rbp_off << LogBytesPerInt), rbp);
3131
3132 // compiler left unloaded_class_index in j_rarg0 move to where the
3133 // runtime expects it.
3134 __ movl(c_rarg1, j_rarg0);
3135
3136 __ set_last_Java_frame(noreg, noreg, NULL);
3137
3138 // Call C code. Need thread but NOT official VM entry
3139 // crud. We cannot block on this call, no GC can happen. Call should
3140 // capture callee-saved registers as well as return values.
3141 // Thread is in rdi already.
3142 //
3143 // UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index);
3144
3145 __ mov(c_rarg0, r15_thread);
3146 __ movl(c_rarg2, Deoptimization::Unpack_uncommon_trap);
3147 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
3148
3149 // Set an oopmap for the call site
3150 OopMapSet* oop_maps = new OopMapSet();
3151 OopMap* map = new OopMap(SimpleRuntimeFrame::framesize, 0);
3152
3153 // location of rbp is known implicitly by the frame sender code
3154
3155 oop_maps->add_gc_map(__ pc() - start, map);
3156
3157 __ reset_last_Java_frame(false, false);
3158
3159 // Load UnrollBlock* into rdi
3160 __ mov(rdi, rax);
3161
3162 #ifdef ASSERT
3163 { Label L;
3164 __ cmpptr(Address(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()),
3165 (int32_t)Deoptimization::Unpack_uncommon_trap);
3166 __ jcc(Assembler::equal, L);
3167 __ stop("SharedRuntime::generate_deopt_blob: expected Unpack_uncommon_trap");
3168 __ bind(L);
3169 }
3170 #endif
3171
3172 // Pop all the frames we must move/replace.
3173 //
3174 // Frame picture (youngest to oldest)
3175 // 1: self-frame (no frame link)
3176 // 2: deopting frame (no frame link)
3177 // 3: caller of deopting frame (could be compiled/interpreted).
3178
3179 // Pop self-frame. We have no frame, and must rely only on rax and rsp.
3180 __ addptr(rsp, (SimpleRuntimeFrame::framesize - 2) << LogBytesPerInt); // Epilog!
3181
3182 // Pop deoptimized frame (int)
3183 __ movl(rcx, Address(rdi,
3184 Deoptimization::UnrollBlock::
3185 size_of_deoptimized_frame_offset_in_bytes()));
3186 __ addptr(rsp, rcx);
3187
3188 // rsp should be pointing at the return address to the caller (3)
3189
3190 // Pick up the initial fp we should save
|