1734 if (UseOnStackReplacement) { 1735 // invocation counter overflow 1736 __ bind(backedge_counter_overflow); 1737 __ negptr(rdx); 1738 __ addptr(rdx, r13); // branch bcp 1739 // IcoResult frequency_counter_overflow([JavaThread*], address branch_bcp) 1740 __ call_VM(noreg, 1741 CAST_FROM_FN_PTR(address, 1742 InterpreterRuntime::frequency_counter_overflow), 1743 rdx); 1744 __ load_unsigned_byte(rbx, Address(r13, 0)); // restore target bytecode 1745 1746 // rax: osr nmethod (osr ok) or NULL (osr not possible) 1747 // ebx: target bytecode 1748 // rdx: scratch 1749 // r14: locals pointer 1750 // r13: bcp 1751 __ testptr(rax, rax); // test result 1752 __ jcc(Assembler::zero, dispatch); // no osr if null 1753 // nmethod may have been invalidated (VM may block upon call_VM return) 1754 __ movl(rcx, Address(rax, nmethod::entry_bci_offset())); 1755 __ cmpl(rcx, InvalidOSREntryBci); 1756 __ jcc(Assembler::equal, dispatch); 1757 1758 // We have the address of an on stack replacement routine in eax 1759 // We need to prepare to execute the OSR method. First we must 1760 // migrate the locals and monitors off of the stack. 1761 1762 __ mov(r13, rax); // save the nmethod 1763 1764 call_VM(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin)); 1765 1766 // eax is OSR buffer, move it to expected parameter location 1767 __ mov(j_rarg0, rax); 1768 1769 // We use j_rarg definitions here so that registers don't conflict as parameter 1770 // registers change across platforms as we are in the midst of a calling 1771 // sequence to the OSR nmethod and we don't want collision. These are NOT parameters. 1772 1773 const Register retaddr = j_rarg2; 1774 const Register sender_sp = j_rarg1; 1775 1776 // pop the interpreter frame | 1734 if (UseOnStackReplacement) { 1735 // invocation counter overflow 1736 __ bind(backedge_counter_overflow); 1737 __ negptr(rdx); 1738 __ addptr(rdx, r13); // branch bcp 1739 // IcoResult frequency_counter_overflow([JavaThread*], address branch_bcp) 1740 __ call_VM(noreg, 1741 CAST_FROM_FN_PTR(address, 1742 InterpreterRuntime::frequency_counter_overflow), 1743 rdx); 1744 __ load_unsigned_byte(rbx, Address(r13, 0)); // restore target bytecode 1745 1746 // rax: osr nmethod (osr ok) or NULL (osr not possible) 1747 // ebx: target bytecode 1748 // rdx: scratch 1749 // r14: locals pointer 1750 // r13: bcp 1751 __ testptr(rax, rax); // test result 1752 __ jcc(Assembler::zero, dispatch); // no osr if null 1753 // nmethod may have been invalidated (VM may block upon call_VM return) 1754 __ cmpb(Address(rax, nmethod::state_offset()), 0); 1755 __ jcc(Assembler::notEqual, dispatch); 1756 1757 // We have the address of an on stack replacement routine in eax 1758 // We need to prepare to execute the OSR method. First we must 1759 // migrate the locals and monitors off of the stack. 1760 1761 __ mov(r13, rax); // save the nmethod 1762 1763 call_VM(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin)); 1764 1765 // eax is OSR buffer, move it to expected parameter location 1766 __ mov(j_rarg0, rax); 1767 1768 // We use j_rarg definitions here so that registers don't conflict as parameter 1769 // registers change across platforms as we are in the midst of a calling 1770 // sequence to the OSR nmethod and we don't want collision. These are NOT parameters. 1771 1772 const Register retaddr = j_rarg2; 1773 const Register sender_sp = j_rarg1; 1774 1775 // pop the interpreter frame |