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