< prev index next >

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

Print this page

1489   save_bcp();
1490 #ifdef ASSERT
1491   {
1492     Label L;
1493     ldr(rscratch1, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
1494     cbz(rscratch1, L);
1495     stop("InterpreterMacroAssembler::call_VM_base:"
1496          " last_sp != nullptr");
1497     bind(L);
1498   }
1499 #endif /* ASSERT */
1500   // super call
1501   MacroAssembler::call_VM_base(oop_result, noreg, last_java_sp,
1502                                entry_point, number_of_arguments,
1503                      check_exceptions);
1504 // interpreter specific
1505   restore_bcp();
1506   restore_locals();
1507 }
1508 
1509 void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result,
1510                                                     address entry_point,
1511                                                     Register arg_1) {
1512   assert(arg_1 == c_rarg1, "");
1513   Label resume_pc, not_preempted;
1514 
1515 #ifdef ASSERT
1516   {
1517     Label L;
1518     ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1519     cbz(rscratch1, L);
1520     stop("Should not have alternate return address set");
1521     bind(L);
1522   }
1523 #endif /* ASSERT */
1524 
1525   // Force freeze slow path.
1526   push_cont_fastpath();
1527 
1528   // Make VM call. In case of preemption set last_pc to the one we want to resume to.
1529   adr(rscratch1, resume_pc);
1530   str(rscratch1, Address(rthread, JavaThread::last_Java_pc_offset()));
1531   call_VM_base(oop_result, noreg, noreg, entry_point, 1, false /*check_exceptions*/);
1532 
1533   pop_cont_fastpath();
1534 
1535   // Check if preempted.
1536   ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1537   cbz(rscratch1, not_preempted);
1538   str(zr, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1539   br(rscratch1);
1540 
1541   // In case of preemption, this is where we will resume once we finally acquire the monitor.
1542   bind(resume_pc);
1543   restore_after_resume(false /* is_native */);
1544 















1545   bind(not_preempted);
1546 }
1547 































1548 void InterpreterMacroAssembler::restore_after_resume(bool is_native) {
1549   lea(rscratch1, ExternalAddress(Interpreter::cont_resume_interpreter_adapter()));
1550   blr(rscratch1);
1551   if (is_native) {
1552     // On resume we need to set up stack as expected
1553     push(dtos);
1554     push(ltos);
1555   }
1556 }
1557 
1558 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
1559   assert_different_registers(obj, rscratch1, mdo_addr.base(), mdo_addr.index());
1560   Label update, next, none;
1561 
1562   verify_oop(obj);
1563 
1564   cbnz(obj, update);
1565   orptr(mdo_addr, TypeEntries::null_seen);
1566   b(next);
1567 

1489   save_bcp();
1490 #ifdef ASSERT
1491   {
1492     Label L;
1493     ldr(rscratch1, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
1494     cbz(rscratch1, L);
1495     stop("InterpreterMacroAssembler::call_VM_base:"
1496          " last_sp != nullptr");
1497     bind(L);
1498   }
1499 #endif /* ASSERT */
1500   // super call
1501   MacroAssembler::call_VM_base(oop_result, noreg, last_java_sp,
1502                                entry_point, number_of_arguments,
1503                      check_exceptions);
1504 // interpreter specific
1505   restore_bcp();
1506   restore_locals();
1507 }
1508 
1509 void InterpreterMacroAssembler::call_VM_preemptable_helper(Register oop_result,
1510                                                            address entry_point,
1511                                                            int number_of_arguments,
1512                                                            bool check_exceptions) {
1513   Label resume_pc, not_preempted;
1514 
1515 #ifdef ASSERT
1516   {
1517     Label L;
1518     ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1519     cbz(rscratch1, L);
1520     stop("Should not have alternate return address set");
1521     bind(L);
1522   }
1523 #endif /* ASSERT */
1524 
1525   // Force freeze slow path.
1526   push_cont_fastpath();
1527 
1528   // Make VM call. In case of preemption set last_pc to the one we want to resume to.
1529   adr(rscratch1, resume_pc);
1530   str(rscratch1, Address(rthread, JavaThread::last_Java_pc_offset()));
1531   MacroAssembler::call_VM_helper(oop_result, entry_point, number_of_arguments, check_exceptions);
1532 
1533   pop_cont_fastpath();
1534 
1535   // Check if preempted.
1536   ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1537   cbz(rscratch1, not_preempted);
1538   str(zr, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1539   br(rscratch1);
1540 
1541   // In case of preemption, this is where we will resume once we finally acquire the monitor.
1542   bind(resume_pc);
1543   restore_after_resume(false /* is_native */);
1544 
1545   if (check_exceptions) {
1546     // check for pending exceptions (java_thread is set upon return)
1547     ldr(rscratch1, Address(rthread, in_bytes(Thread::pending_exception_offset())));
1548     Label ok;
1549     cbz(rscratch1, ok);
1550     lea(rscratch1, RuntimeAddress(StubRoutines::forward_exception_entry()));
1551     br(rscratch1);
1552     bind(ok);
1553   }
1554 
1555   // get oop result if there is one and reset the value in the thread
1556   if (oop_result->is_valid()) {
1557     get_vm_result_oop(oop_result, rthread);
1558   }
1559 
1560   bind(not_preempted);
1561 }
1562 
1563 static void pass_arg1(MacroAssembler* masm, Register arg) {
1564   if (c_rarg1 != arg ) {
1565     masm->mov(c_rarg1, arg);
1566   }
1567 }
1568 
1569 static void pass_arg2(MacroAssembler* masm, Register arg) {
1570   if (c_rarg2 != arg ) {
1571     masm->mov(c_rarg2, arg);
1572   }
1573 }
1574 
1575 void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result,
1576                                          address entry_point,
1577                                          Register arg_1,
1578                                          bool check_exceptions) {
1579   pass_arg1(this, arg_1);
1580   call_VM_preemptable_helper(oop_result, entry_point, 1, check_exceptions);
1581 }
1582 
1583 void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result,
1584                                          address entry_point,
1585                                          Register arg_1,
1586                                          Register arg_2,
1587                                          bool check_exceptions) {
1588   LP64_ONLY(assert_different_registers(arg_1, c_rarg2));
1589   pass_arg2(this, arg_2);
1590   pass_arg1(this, arg_1);
1591   call_VM_preemptable_helper(oop_result, entry_point, 2, check_exceptions);
1592 }
1593 
1594 void InterpreterMacroAssembler::restore_after_resume(bool is_native) {
1595   lea(rscratch1, ExternalAddress(Interpreter::cont_resume_interpreter_adapter()));
1596   blr(rscratch1);
1597   if (is_native) {
1598     // On resume we need to set up stack as expected
1599     push(dtos);
1600     push(ltos);
1601   }
1602 }
1603 
1604 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
1605   assert_different_registers(obj, rscratch1, mdo_addr.base(), mdo_addr.index());
1606   Label update, next, none;
1607 
1608   verify_oop(obj);
1609 
1610   cbnz(obj, update);
1611   orptr(mdo_addr, TypeEntries::null_seen);
1612   b(next);
1613 
< prev index next >