src/cpu/sparc/vm/cppInterpreter_sparc.cpp

changeset 3037
3d42f82cd811
parent 2901
3d2ab563047a
child 3391
069ab3f976d3
equal deleted inserted replaced
3036:6a991dcb52bb 3037:3d42f82cd811
542 __ retl(); // return from leaf routine 542 __ retl(); // return from leaf routine
543 __ delayed()->mov(O5_savedSP, SP); 543 __ delayed()->mov(O5_savedSP, SP);
544 544
545 // Generate regular method entry 545 // Generate regular method entry
546 __ bind(slow_path); 546 __ bind(slow_path);
547 __ ba(false, fast_accessor_slow_entry_path); 547 __ ba(fast_accessor_slow_entry_path);
548 __ delayed()->nop(); 548 __ delayed()->nop();
549 return entry; 549 return entry;
550 } 550 }
551 return NULL; 551 return NULL;
552 } 552 }
717 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::prepare_native_call), G5_method, false); 717 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::prepare_native_call), G5_method, false);
718 __ ld_ptr(STATE(_method), G5_method); 718 __ ld_ptr(STATE(_method), G5_method);
719 719
720 Address exception_addr(G2_thread, 0, in_bytes(Thread::pending_exception_offset())); 720 Address exception_addr(G2_thread, 0, in_bytes(Thread::pending_exception_offset()));
721 __ ld_ptr(exception_addr, G3_scratch); 721 __ ld_ptr(exception_addr, G3_scratch);
722 __ br_notnull(G3_scratch, false, Assembler::pn, pending_exception_present); 722 __ br_notnull_short(G3_scratch, Assembler::pn, pending_exception_present);
723 __ delayed()->nop();
724 __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::signature_handler_offset())), G3_scratch); 723 __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::signature_handler_offset())), G3_scratch);
725 __ bind(L); 724 __ bind(L);
726 } 725 }
727 726
728 // Push a new frame so that the args will really be stored in 727 // Push a new frame so that the args will really be stored in
1290 1289
1291 // deopt needs to jump to here to enter the interpreter (return a result) 1290 // deopt needs to jump to here to enter the interpreter (return a result)
1292 deopt_frame_manager_return_atos = __ pc(); 1291 deopt_frame_manager_return_atos = __ pc();
1293 1292
1294 // O0/O1 live 1293 // O0/O1 live
1295 __ ba(false, return_from_deopt_common); 1294 __ ba(return_from_deopt_common);
1296 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_OBJECT), L3_scratch); // Result stub address array index 1295 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_OBJECT), L3_scratch); // Result stub address array index
1297 1296
1298 1297
1299 // deopt needs to jump to here to enter the interpreter (return a result) 1298 // deopt needs to jump to here to enter the interpreter (return a result)
1300 deopt_frame_manager_return_btos = __ pc(); 1299 deopt_frame_manager_return_btos = __ pc();
1301 1300
1302 // O0/O1 live 1301 // O0/O1 live
1303 __ ba(false, return_from_deopt_common); 1302 __ ba(return_from_deopt_common);
1304 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_BOOLEAN), L3_scratch); // Result stub address array index 1303 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_BOOLEAN), L3_scratch); // Result stub address array index
1305 1304
1306 // deopt needs to jump to here to enter the interpreter (return a result) 1305 // deopt needs to jump to here to enter the interpreter (return a result)
1307 deopt_frame_manager_return_itos = __ pc(); 1306 deopt_frame_manager_return_itos = __ pc();
1308 1307
1309 // O0/O1 live 1308 // O0/O1 live
1310 __ ba(false, return_from_deopt_common); 1309 __ ba(return_from_deopt_common);
1311 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_INT), L3_scratch); // Result stub address array index 1310 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_INT), L3_scratch); // Result stub address array index
1312 1311
1313 // deopt needs to jump to here to enter the interpreter (return a result) 1312 // deopt needs to jump to here to enter the interpreter (return a result)
1314 1313
1315 deopt_frame_manager_return_ltos = __ pc(); 1314 deopt_frame_manager_return_ltos = __ pc();
1325 1324
1326 __ srl (G1, 0,O1); 1325 __ srl (G1, 0,O1);
1327 __ srlx(G1,32,O0); 1326 __ srlx(G1,32,O0);
1328 #endif /* !_LP64 && COMPILER2 */ 1327 #endif /* !_LP64 && COMPILER2 */
1329 // O0/O1 live 1328 // O0/O1 live
1330 __ ba(false, return_from_deopt_common); 1329 __ ba(return_from_deopt_common);
1331 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_LONG), L3_scratch); // Result stub address array index 1330 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_LONG), L3_scratch); // Result stub address array index
1332 1331
1333 // deopt needs to jump to here to enter the interpreter (return a result) 1332 // deopt needs to jump to here to enter the interpreter (return a result)
1334 1333
1335 deopt_frame_manager_return_ftos = __ pc(); 1334 deopt_frame_manager_return_ftos = __ pc();
1336 // O0/O1 live 1335 // O0/O1 live
1337 __ ba(false, return_from_deopt_common); 1336 __ ba(return_from_deopt_common);
1338 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_FLOAT), L3_scratch); // Result stub address array index 1337 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_FLOAT), L3_scratch); // Result stub address array index
1339 1338
1340 // deopt needs to jump to here to enter the interpreter (return a result) 1339 // deopt needs to jump to here to enter the interpreter (return a result)
1341 deopt_frame_manager_return_dtos = __ pc(); 1340 deopt_frame_manager_return_dtos = __ pc();
1342 1341
1343 // O0/O1 live 1342 // O0/O1 live
1344 __ ba(false, return_from_deopt_common); 1343 __ ba(return_from_deopt_common);
1345 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_DOUBLE), L3_scratch); // Result stub address array index 1344 __ delayed()->set(AbstractInterpreter::BasicType_as_index(T_DOUBLE), L3_scratch); // Result stub address array index
1346 1345
1347 // deopt needs to jump to here to enter the interpreter (return a result) 1346 // deopt needs to jump to here to enter the interpreter (return a result)
1348 deopt_frame_manager_return_vtos = __ pc(); 1347 deopt_frame_manager_return_vtos = __ pc();
1349 1348
1396 __ st_ptr(L2_scratch, STATE(_stack_limit)); 1395 __ st_ptr(L2_scratch, STATE(_stack_limit));
1397 1396
1398 __ ld_ptr(STATE(_stack), L1_scratch); // Get current stack top 1397 __ ld_ptr(STATE(_stack), L1_scratch); // Get current stack top
1399 __ sub(L1_scratch, entry_size, L1_scratch); 1398 __ sub(L1_scratch, entry_size, L1_scratch);
1400 __ st_ptr(L1_scratch, STATE(_stack)); 1399 __ st_ptr(L1_scratch, STATE(_stack));
1401 __ ba(false, entry); 1400 __ ba(entry);
1402 __ delayed()->add(L1_scratch, wordSize, L1_scratch); // first real entry (undo prepush) 1401 __ delayed()->add(L1_scratch, wordSize, L1_scratch); // first real entry (undo prepush)
1403 1402
1404 // 2. move expression stack 1403 // 2. move expression stack
1405 1404
1406 __ bind(loop); 1405 __ bind(loop);
1649 1648
1650 // new monitor slot allocated, resume the interpreter. 1649 // new monitor slot allocated, resume the interpreter.
1651 1650
1652 __ set((int)BytecodeInterpreter::got_monitors, L1_scratch); 1651 __ set((int)BytecodeInterpreter::got_monitors, L1_scratch);
1653 VALIDATE_STATE(G3_scratch, 5); 1652 VALIDATE_STATE(G3_scratch, 5);
1654 __ ba(false, call_interpreter); 1653 __ ba(call_interpreter);
1655 __ delayed()->st(L1_scratch, STATE(_msg)); 1654 __ delayed()->st(L1_scratch, STATE(_msg));
1656 1655
1657 // uncommon trap needs to jump to here to enter the interpreter (re-execute current bytecode) 1656 // uncommon trap needs to jump to here to enter the interpreter (re-execute current bytecode)
1658 unctrap_frame_manager_entry = __ pc(); 1657 unctrap_frame_manager_entry = __ pc();
1659 1658
1660 // QQQ what message do we send 1659 // QQQ what message do we send
1661 1660
1662 __ ba(false, call_interpreter); 1661 __ ba(call_interpreter);
1663 __ delayed()->ld_ptr(STATE(_frame_bottom), SP); // restore to full stack frame 1662 __ delayed()->ld_ptr(STATE(_frame_bottom), SP); // restore to full stack frame
1664 1663
1665 //============================================================================= 1664 //=============================================================================
1666 // Returning from a compiled method into a deopted method. The bytecode at the 1665 // Returning from a compiled method into a deopted method. The bytecode at the
1667 // bcp has completed. The result of the bytecode is in the native abi (the tosca 1666 // bcp has completed. The result of the bytecode is in the native abi (the tosca
1673 generate_deopt_handling(); 1672 generate_deopt_handling();
1674 1673
1675 // ready to resume the interpreter 1674 // ready to resume the interpreter
1676 1675
1677 __ set((int)BytecodeInterpreter::deopt_resume, L1_scratch); 1676 __ set((int)BytecodeInterpreter::deopt_resume, L1_scratch);
1678 __ ba(false, call_interpreter); 1677 __ ba(call_interpreter);
1679 __ delayed()->st(L1_scratch, STATE(_msg)); 1678 __ delayed()->st(L1_scratch, STATE(_msg));
1680 1679
1681 // Current frame has caught an exception we need to dispatch to the 1680 // Current frame has caught an exception we need to dispatch to the
1682 // handler. We can get here because a native interpreter frame caught 1681 // handler. We can get here because a native interpreter frame caught
1683 // an exception in which case there is no handler and we must rethrow 1682 // an exception in which case there is no handler and we must rethrow
1761 __ jmpl(Lscratch, G0, O7); // and convert it 1760 __ jmpl(Lscratch, G0, O7); // and convert it
1762 __ delayed()->nop(); 1761 __ delayed()->nop();
1763 1762
1764 // L1_scratch points to top of stack (prepushed) 1763 // L1_scratch points to top of stack (prepushed)
1765 1764
1766 __ ba(false, resume_interpreter); 1765 __ ba(resume_interpreter);
1767 __ delayed()->mov(L1_scratch, O1); 1766 __ delayed()->mov(L1_scratch, O1);
1768 1767
1769 // An exception is being caught on return to a vanilla interpreter frame. 1768 // An exception is being caught on return to a vanilla interpreter frame.
1770 // Empty the stack and resume interpreter 1769 // Empty the stack and resume interpreter
1771 1770
1772 __ bind(return_with_exception); 1771 __ bind(return_with_exception);
1773 1772
1774 __ ld_ptr(STATE(_frame_bottom), SP); // restore to full stack frame 1773 __ ld_ptr(STATE(_frame_bottom), SP); // restore to full stack frame
1775 __ ld_ptr(STATE(_stack_base), O1); // empty java expression stack 1774 __ ld_ptr(STATE(_stack_base), O1); // empty java expression stack
1776 __ ba(false, resume_interpreter); 1775 __ ba(resume_interpreter);
1777 __ delayed()->sub(O1, wordSize, O1); // account for prepush 1776 __ delayed()->sub(O1, wordSize, O1); // account for prepush
1778 1777
1779 // Return from interpreted method we return result appropriate to the caller (i.e. "recursive" 1778 // Return from interpreted method we return result appropriate to the caller (i.e. "recursive"
1780 // interpreter call, or native) and unwind this interpreter activation. 1779 // interpreter call, or native) and unwind this interpreter activation.
1781 // All monitors should be unlocked. 1780 // All monitors should be unlocked.
1850 1849
1851 // A frame we have already used before so no need to bang stack so use call_interpreter_2 entry 1850 // A frame we have already used before so no need to bang stack so use call_interpreter_2 entry
1852 1851
1853 __ set((int)BytecodeInterpreter::method_resume, L1_scratch); 1852 __ set((int)BytecodeInterpreter::method_resume, L1_scratch);
1854 __ st(L1_scratch, STATE(_msg)); 1853 __ st(L1_scratch, STATE(_msg));
1855 __ ba(false, call_interpreter_2); 1854 __ ba(call_interpreter_2);
1856 __ delayed()->st_ptr(O1, STATE(_stack)); 1855 __ delayed()->st_ptr(O1, STATE(_stack));
1857 1856
1858 1857
1859 // Fast accessor methods share this entry point. 1858 // Fast accessor methods share this entry point.
1860 // This works because frame manager is in the same codelet 1859 // This works because frame manager is in the same codelet
1865 __ bind(fast_accessor_slow_entry_path); 1864 __ bind(fast_accessor_slow_entry_path);
1866 __ set((intptr_t)return_from_native_method - 8, Gtmp1); 1865 __ set((intptr_t)return_from_native_method - 8, Gtmp1);
1867 __ cmp(Gtmp1, O7); // returning to interpreter? 1866 __ cmp(Gtmp1, O7); // returning to interpreter?
1868 __ brx(Assembler::equal, true, Assembler::pt, re_dispatch); // yep 1867 __ brx(Assembler::equal, true, Assembler::pt, re_dispatch); // yep
1869 __ delayed()->nop(); 1868 __ delayed()->nop();
1870 __ ba(false, re_dispatch); 1869 __ ba(re_dispatch);
1871 __ delayed()->mov(G0, prevState); // initial entry 1870 __ delayed()->mov(G0, prevState); // initial entry
1872 1871
1873 } 1872 }
1874 1873
1875 // interpreter returning to native code (call_stub/c1/c2) 1874 // interpreter returning to native code (call_stub/c1/c2)
1876 // convert result and unwind initial activation 1875 // convert result and unwind initial activation
2029 __ ld_ptr(STATE(_prev_link), L1_scratch); 2028 __ ld_ptr(STATE(_prev_link), L1_scratch);
2030 __ tst(L1_scratch); 2029 __ tst(L1_scratch);
2031 __ brx(Assembler::zero, false, Assembler::pt, unwind_and_forward); 2030 __ brx(Assembler::zero, false, Assembler::pt, unwind_and_forward);
2032 __ delayed()->nop(); 2031 __ delayed()->nop();
2033 2032
2034 __ ld_ptr(STATE(_locals), O1); // get result of popping callee's args 2033 __ ld_ptr(STATE(_locals), O1); // get result of popping callee's args
2035 __ ba(false, unwind_recursive_activation); 2034 __ ba(unwind_recursive_activation);
2036 __ delayed()->nop(); 2035 __ delayed()->nop();
2037 2036
2038 interpreter_frame_manager = entry_point; 2037 interpreter_frame_manager = entry_point;
2039 return entry_point; 2038 return entry_point;
2040 } 2039 }

mercurial