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