2795 // restore return values to their stack-slots with the new SP. |
2795 // restore return values to their stack-slots with the new SP. |
2796 // |
2796 // |
2797 // void Deoptimization::unpack_frames(JavaThread* thread, int exec_mode) |
2797 // void Deoptimization::unpack_frames(JavaThread* thread, int exec_mode) |
2798 |
2798 |
2799 // Use rbp because the frames look interpreted now |
2799 // Use rbp because the frames look interpreted now |
2800 __ set_last_Java_frame(noreg, rbp, NULL); |
2800 // Save "the_pc" since it cannot easily be retrieved using the last_java_SP after we aligned SP. |
2801 |
2801 // Don't need the precise return PC here, just precise enough to point into this code blob. |
|
2802 address the_pc = __ pc(); |
|
2803 __ set_last_Java_frame(noreg, rbp, the_pc); |
|
2804 |
|
2805 __ andptr(rsp, -(StackAlignmentInBytes)); // Fix stack alignment as required by ABI |
2802 __ mov(c_rarg0, r15_thread); |
2806 __ mov(c_rarg0, r15_thread); |
2803 __ movl(c_rarg1, r14); // second arg: exec_mode |
2807 __ movl(c_rarg1, r14); // second arg: exec_mode |
2804 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames))); |
2808 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames))); |
|
2809 // Revert SP alignment after call since we're going to do some SP relative addressing below |
|
2810 __ movptr(rsp, Address(r15_thread, JavaThread::last_Java_sp_offset())); |
2805 |
2811 |
2806 // Set an oopmap for the call site |
2812 // Set an oopmap for the call site |
2807 oop_maps->add_gc_map(__ pc() - start, |
2813 // Use the same PC we used for the last java frame |
|
2814 oop_maps->add_gc_map(the_pc - start, |
2808 new OopMap( frame_size_in_words, 0 )); |
2815 new OopMap( frame_size_in_words, 0 )); |
2809 |
2816 |
2810 __ reset_last_Java_frame(true, false); |
2817 // Clear fp AND pc |
|
2818 __ reset_last_Java_frame(true, true); |
2811 |
2819 |
2812 // Collect return values |
2820 // Collect return values |
2813 __ movdbl(xmm0, Address(rsp, RegisterSaver::xmm0_offset_in_bytes())); |
2821 __ movdbl(xmm0, Address(rsp, RegisterSaver::xmm0_offset_in_bytes())); |
2814 __ movptr(rax, Address(rsp, RegisterSaver::rax_offset_in_bytes())); |
2822 __ movptr(rax, Address(rsp, RegisterSaver::rax_offset_in_bytes())); |
2815 // I think this is useless (throwing pc?) |
2823 // I think this is useless (throwing pc?) |
2966 __ enter(); // Save old & set new rbp |
2974 __ enter(); // Save old & set new rbp |
2967 __ subptr(rsp, (SimpleRuntimeFrame::framesize - 4) << LogBytesPerInt); |
2975 __ subptr(rsp, (SimpleRuntimeFrame::framesize - 4) << LogBytesPerInt); |
2968 // Prolog |
2976 // Prolog |
2969 |
2977 |
2970 // Use rbp because the frames look interpreted now |
2978 // Use rbp because the frames look interpreted now |
2971 __ set_last_Java_frame(noreg, rbp, NULL); |
2979 // Save "the_pc" since it cannot easily be retrieved using the last_java_SP after we aligned SP. |
|
2980 // Don't need the precise return PC here, just precise enough to point into this code blob. |
|
2981 address the_pc = __ pc(); |
|
2982 __ set_last_Java_frame(noreg, rbp, the_pc); |
2972 |
2983 |
2973 // Call C code. Need thread but NOT official VM entry |
2984 // Call C code. Need thread but NOT official VM entry |
2974 // crud. We cannot block on this call, no GC can happen. Call should |
2985 // crud. We cannot block on this call, no GC can happen. Call should |
2975 // restore return values to their stack-slots with the new SP. |
2986 // restore return values to their stack-slots with the new SP. |
2976 // Thread is in rdi already. |
2987 // Thread is in rdi already. |
2977 // |
2988 // |
2978 // BasicType unpack_frames(JavaThread* thread, int exec_mode); |
2989 // BasicType unpack_frames(JavaThread* thread, int exec_mode); |
2979 |
2990 |
|
2991 __ andptr(rsp, -(StackAlignmentInBytes)); // Align SP as required by ABI |
2980 __ mov(c_rarg0, r15_thread); |
2992 __ mov(c_rarg0, r15_thread); |
2981 __ movl(c_rarg1, Deoptimization::Unpack_uncommon_trap); |
2993 __ movl(c_rarg1, Deoptimization::Unpack_uncommon_trap); |
2982 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames))); |
2994 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames))); |
2983 |
2995 |
2984 // Set an oopmap for the call site |
2996 // Set an oopmap for the call site |
2985 oop_maps->add_gc_map(__ pc() - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); |
2997 // Use the same PC we used for the last java frame |
2986 |
2998 oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); |
2987 __ reset_last_Java_frame(true, false); |
2999 |
|
3000 // Clear fp AND pc |
|
3001 __ reset_last_Java_frame(true, true); |
2988 |
3002 |
2989 // Pop self-frame. |
3003 // Pop self-frame. |
2990 __ leave(); // Epilog |
3004 __ leave(); // Epilog |
2991 |
3005 |
2992 // Jump to interpreter |
3006 // Jump to interpreter |