1707 __ jmp(dispatch); 1708 } 1709 1710 if (UseOnStackReplacement) { 1711 1712 // invocation counter overflow 1713 __ bind(backedge_counter_overflow); 1714 __ negptr(rdx); 1715 __ addptr(rdx, rsi); // branch bcp 1716 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), rdx); 1717 __ load_unsigned_byte(rbx, Address(rsi, 0)); // restore target bytecode 1718 1719 // rax,: osr nmethod (osr ok) or NULL (osr not possible) 1720 // rbx,: target bytecode 1721 // rdx: scratch 1722 // rdi: locals pointer 1723 // rsi: bcp 1724 __ testptr(rax, rax); // test result 1725 __ jcc(Assembler::zero, dispatch); // no osr if null 1726 // nmethod may have been invalidated (VM may block upon call_VM return) 1727 __ movl(rcx, Address(rax, nmethod::entry_bci_offset())); 1728 __ cmpl(rcx, InvalidOSREntryBci); 1729 __ jcc(Assembler::equal, dispatch); 1730 1731 // We have the address of an on stack replacement routine in rax, 1732 // We need to prepare to execute the OSR method. First we must 1733 // migrate the locals and monitors off of the stack. 1734 1735 __ mov(rbx, rax); // save the nmethod 1736 1737 const Register thread = rcx; 1738 __ get_thread(thread); 1739 call_VM(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin)); 1740 // rax, is OSR buffer, move it to expected parameter location 1741 __ mov(rcx, rax); 1742 1743 // pop the interpreter frame 1744 __ movptr(rdx, Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize)); // get sender sp 1745 __ leave(); // remove frame anchor 1746 __ pop(rdi); // get return address 1747 __ mov(rsp, rdx); // set sp to sender sp 1748 1749 // Align stack pointer for compiled code (note that caller is 1750 // responsible for undoing this fixup by remembering the old SP 1751 // in an rbp,-relative location) 1752 __ andptr(rsp, -(StackAlignmentInBytes)); 1753 1754 // push the (possibly adjusted) return address 1755 __ push(rdi); 1756 1757 // and begin the OSR nmethod 1758 __ jmp(Address(rbx, nmethod::osr_entry_point_offset())); | 1707 __ jmp(dispatch); 1708 } 1709 1710 if (UseOnStackReplacement) { 1711 1712 // invocation counter overflow 1713 __ bind(backedge_counter_overflow); 1714 __ negptr(rdx); 1715 __ addptr(rdx, rsi); // branch bcp 1716 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), rdx); 1717 __ load_unsigned_byte(rbx, Address(rsi, 0)); // restore target bytecode 1718 1719 // rax,: osr nmethod (osr ok) or NULL (osr not possible) 1720 // rbx,: target bytecode 1721 // rdx: scratch 1722 // rdi: locals pointer 1723 // rsi: bcp 1724 __ testptr(rax, rax); // test result 1725 __ jcc(Assembler::zero, dispatch); // no osr if null 1726 // nmethod may have been invalidated (VM may block upon call_VM return) 1727 __ cmpb(Address(rax, nmethod::state_offset()), nmethod::in_use); 1728 __ jcc(Assembler::notEqual, dispatch); 1729 1730 // We have the address of an on stack replacement routine in rax, 1731 // We need to prepare to execute the OSR method. First we must 1732 // migrate the locals and monitors off of the stack. 1733 1734 __ mov(rbx, rax); // save the nmethod 1735 1736 __ get_thread(rcx); 1737 call_VM(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin)); 1738 // rax, is OSR buffer, move it to expected parameter location 1739 __ mov(rcx, rax); 1740 1741 // pop the interpreter frame 1742 __ movptr(rdx, Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize)); // get sender sp 1743 __ leave(); // remove frame anchor 1744 __ pop(rdi); // get return address 1745 __ mov(rsp, rdx); // set sp to sender sp 1746 1747 // Align stack pointer for compiled code (note that caller is 1748 // responsible for undoing this fixup by remembering the old SP 1749 // in an rbp,-relative location) 1750 __ andptr(rsp, -(StackAlignmentInBytes)); 1751 1752 // push the (possibly adjusted) return address 1753 __ push(rdi); 1754 1755 // and begin the OSR nmethod 1756 __ jmp(Address(rbx, nmethod::osr_entry_point_offset())); |