2543 // Need to have an oopmap that tells fetch_unroll_info where to |
2543 // Need to have an oopmap that tells fetch_unroll_info where to |
2544 // find any register it might need. |
2544 // find any register it might need. |
2545 |
2545 |
2546 oop_maps->add_gc_map( __ pc()-start, map); |
2546 oop_maps->add_gc_map( __ pc()-start, map); |
2547 |
2547 |
2548 // Discard arg to fetch_unroll_info |
2548 // Discard args to fetch_unroll_info |
|
2549 __ pop(rcx); |
2549 __ pop(rcx); |
2550 __ pop(rcx); |
2550 |
2551 |
2551 __ get_thread(rcx); |
2552 __ get_thread(rcx); |
2552 __ reset_last_Java_frame(rcx, false, false); |
2553 __ reset_last_Java_frame(rcx, false, false); |
2553 |
2554 |
2556 |
2557 |
2557 // Move the unpack kind to a safe place in the UnrollBlock because |
2558 // Move the unpack kind to a safe place in the UnrollBlock because |
2558 // we are very short of registers |
2559 // we are very short of registers |
2559 |
2560 |
2560 Address unpack_kind(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()); |
2561 Address unpack_kind(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()); |
2561 // retrieve the deopt kind from where we left it. |
2562 // retrieve the deopt kind from the UnrollBlock. |
2562 __ pop(rax); |
2563 __ movl(rax, unpack_kind); |
2563 __ movl(unpack_kind, rax); // save the unpack_kind value |
|
2564 |
2564 |
2565 Label noException; |
2565 Label noException; |
2566 __ cmpl(rax, Deoptimization::Unpack_exception); // Was exception pending? |
2566 __ cmpl(rax, Deoptimization::Unpack_exception); // Was exception pending? |
2567 __ jcc(Assembler::notEqual, noException); |
2567 __ jcc(Assembler::notEqual, noException); |
2568 __ movptr(rax, Address(rcx, JavaThread::exception_oop_offset())); |
2568 __ movptr(rax, Address(rcx, JavaThread::exception_oop_offset())); |
2768 MacroAssembler* masm = new MacroAssembler(&buffer); |
2768 MacroAssembler* masm = new MacroAssembler(&buffer); |
2769 |
2769 |
2770 enum frame_layout { |
2770 enum frame_layout { |
2771 arg0_off, // thread sp + 0 // Arg location for |
2771 arg0_off, // thread sp + 0 // Arg location for |
2772 arg1_off, // unloaded_class_index sp + 1 // calling C |
2772 arg1_off, // unloaded_class_index sp + 1 // calling C |
|
2773 arg2_off, // exec_mode sp + 2 |
2773 // The frame sender code expects that rbp will be in the "natural" place and |
2774 // The frame sender code expects that rbp will be in the "natural" place and |
2774 // will override any oopMap setting for it. We must therefore force the layout |
2775 // will override any oopMap setting for it. We must therefore force the layout |
2775 // so that it agrees with the frame sender code. |
2776 // so that it agrees with the frame sender code. |
2776 rbp_off, // callee saved register sp + 2 |
2777 rbp_off, // callee saved register sp + 3 |
2777 return_off, // slot for return address sp + 3 |
2778 return_off, // slot for return address sp + 4 |
2778 framesize |
2779 framesize |
2779 }; |
2780 }; |
2780 |
2781 |
2781 address start = __ pc(); |
2782 address start = __ pc(); |
2782 |
2783 |
2804 // crud. We cannot block on this call, no GC can happen. Call should |
2805 // crud. We cannot block on this call, no GC can happen. Call should |
2805 // capture callee-saved registers as well as return values. |
2806 // capture callee-saved registers as well as return values. |
2806 __ movptr(Address(rsp, arg0_off*wordSize), rdx); |
2807 __ movptr(Address(rsp, arg0_off*wordSize), rdx); |
2807 // argument already in ECX |
2808 // argument already in ECX |
2808 __ movl(Address(rsp, arg1_off*wordSize),rcx); |
2809 __ movl(Address(rsp, arg1_off*wordSize),rcx); |
|
2810 __ movl(Address(rsp, arg2_off*wordSize), Deoptimization::Unpack_uncommon_trap); |
2809 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap))); |
2811 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap))); |
2810 |
2812 |
2811 // Set an oopmap for the call site |
2813 // Set an oopmap for the call site |
2812 OopMapSet *oop_maps = new OopMapSet(); |
2814 OopMapSet *oop_maps = new OopMapSet(); |
2813 OopMap* map = new OopMap( framesize, 0 ); |
2815 OopMap* map = new OopMap( framesize, 0 ); |
2819 |
2821 |
2820 __ reset_last_Java_frame(rcx, false, false); |
2822 __ reset_last_Java_frame(rcx, false, false); |
2821 |
2823 |
2822 // Load UnrollBlock into EDI |
2824 // Load UnrollBlock into EDI |
2823 __ movptr(rdi, rax); |
2825 __ movptr(rdi, rax); |
|
2826 |
|
2827 #ifdef ASSERT |
|
2828 { Label L; |
|
2829 __ cmpptr(Address(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()), |
|
2830 (int32_t)Deoptimization::Unpack_uncommon_trap); |
|
2831 __ jcc(Assembler::equal, L); |
|
2832 __ stop("SharedRuntime::generate_deopt_blob: expected Unpack_uncommon_trap"); |
|
2833 __ bind(L); |
|
2834 } |
|
2835 #endif |
2824 |
2836 |
2825 // Pop all the frames we must move/replace. |
2837 // Pop all the frames we must move/replace. |
2826 // |
2838 // |
2827 // Frame picture (youngest to oldest) |
2839 // Frame picture (youngest to oldest) |
2828 // 1: self-frame (no frame link) |
2840 // 1: self-frame (no frame link) |