< prev index next >

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

Print this page

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















1560   bind(not_preempted);
1561 }
1562 































1563 void InterpreterMacroAssembler::restore_after_resume(bool is_native) {
1564   lea(rscratch1, ExternalAddress(Interpreter::cont_resume_interpreter_adapter()));
1565   blr(rscratch1);
1566   if (is_native) {
1567     // On resume we need to set up stack as expected
1568     push(dtos);
1569     push(ltos);
1570   }
1571 }
1572 
1573 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
1574   assert_different_registers(obj, rscratch1, mdo_addr.base(), mdo_addr.index());
1575   Label update, next, none;
1576 
1577   verify_oop(obj);
1578 
1579   cbnz(obj, update);
1580   orptr(mdo_addr, TypeEntries::null_seen);
1581   b(next);
1582 

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