1384 save_bcp();
1385 #ifdef ASSERT
1386 {
1387 Label L;
1388 ldr(rscratch1, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
1389 cbz(rscratch1, L);
1390 stop("InterpreterMacroAssembler::call_VM_base:"
1391 " last_sp != nullptr");
1392 bind(L);
1393 }
1394 #endif /* ASSERT */
1395 // super call
1396 MacroAssembler::call_VM_base(oop_result, noreg, last_java_sp,
1397 entry_point, number_of_arguments,
1398 check_exceptions);
1399 // interpreter specific
1400 restore_bcp();
1401 restore_locals();
1402 }
1403
1404 void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result,
1405 address entry_point,
1406 Register arg_1) {
1407 assert(arg_1 == c_rarg1, "");
1408 Label resume_pc, not_preempted;
1409
1410 #ifdef ASSERT
1411 {
1412 Label L;
1413 ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1414 cbz(rscratch1, L);
1415 stop("Should not have alternate return address set");
1416 bind(L);
1417 }
1418 #endif /* ASSERT */
1419
1420 // Force freeze slow path.
1421 push_cont_fastpath();
1422
1423 // Make VM call. In case of preemption set last_pc to the one we want to resume to.
1424 adr(rscratch1, resume_pc);
1425 str(rscratch1, Address(rthread, JavaThread::last_Java_pc_offset()));
1426 call_VM_base(oop_result, noreg, noreg, entry_point, 1, false /*check_exceptions*/);
1427
1428 pop_cont_fastpath();
1429
1430 // Check if preempted.
1431 ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1432 cbz(rscratch1, not_preempted);
1433 str(zr, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1434 br(rscratch1);
1435
1436 // In case of preemption, this is where we will resume once we finally acquire the monitor.
1437 bind(resume_pc);
1438 restore_after_resume(false /* is_native */);
1439
1440 bind(not_preempted);
1441 }
1442
1443 void InterpreterMacroAssembler::restore_after_resume(bool is_native) {
1444 lea(rscratch1, ExternalAddress(Interpreter::cont_resume_interpreter_adapter()));
1445 blr(rscratch1);
1446 if (is_native) {
1447 // On resume we need to set up stack as expected
1448 push(dtos);
1449 push(ltos);
1450 }
1451 }
1452
1453 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
1454 assert_different_registers(obj, rscratch1, mdo_addr.base(), mdo_addr.index());
1455 Label update, next, none;
1456
1457 verify_oop(obj);
1458
1459 cbnz(obj, update);
1460 orptr(mdo_addr, TypeEntries::null_seen);
1461 b(next);
1462
|
1384 save_bcp();
1385 #ifdef ASSERT
1386 {
1387 Label L;
1388 ldr(rscratch1, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
1389 cbz(rscratch1, L);
1390 stop("InterpreterMacroAssembler::call_VM_base:"
1391 " last_sp != nullptr");
1392 bind(L);
1393 }
1394 #endif /* ASSERT */
1395 // super call
1396 MacroAssembler::call_VM_base(oop_result, noreg, last_java_sp,
1397 entry_point, number_of_arguments,
1398 check_exceptions);
1399 // interpreter specific
1400 restore_bcp();
1401 restore_locals();
1402 }
1403
1404 void InterpreterMacroAssembler::call_VM_preemptable_helper(Register oop_result,
1405 address entry_point,
1406 int number_of_arguments,
1407 bool check_exceptions) {
1408 Label resume_pc, not_preempted;
1409
1410 #ifdef ASSERT
1411 {
1412 Label L;
1413 ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1414 cbz(rscratch1, L);
1415 stop("Should not have alternate return address set");
1416 bind(L);
1417 }
1418 #endif /* ASSERT */
1419
1420 // Force freeze slow path.
1421 push_cont_fastpath();
1422
1423 // Make VM call. In case of preemption set last_pc to the one we want to resume to.
1424 adr(rscratch1, resume_pc);
1425 str(rscratch1, Address(rthread, JavaThread::last_Java_pc_offset()));
1426 MacroAssembler::call_VM_helper(oop_result, entry_point, number_of_arguments, check_exceptions);
1427
1428 pop_cont_fastpath();
1429
1430 // Check if preempted.
1431 ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1432 cbz(rscratch1, not_preempted);
1433 str(zr, Address(rthread, JavaThread::preempt_alternate_return_offset()));
1434 br(rscratch1);
1435
1436 // In case of preemption, this is where we will resume once we finally acquire the monitor.
1437 bind(resume_pc);
1438 restore_after_resume(false /* is_native */);
1439
1440 if (check_exceptions) {
1441 // check for pending exceptions (java_thread is set upon return)
1442 ldr(rscratch1, Address(rthread, in_bytes(Thread::pending_exception_offset())));
1443 Label ok;
1444 cbz(rscratch1, ok);
1445 lea(rscratch1, RuntimeAddress(StubRoutines::forward_exception_entry()));
1446 br(rscratch1);
1447 bind(ok);
1448 }
1449
1450 // get oop result if there is one and reset the value in the thread
1451 if (oop_result->is_valid()) {
1452 get_vm_result_oop(oop_result, rthread);
1453 }
1454
1455 bind(not_preempted);
1456 }
1457
1458 static void pass_arg1(MacroAssembler* masm, Register arg) {
1459 if (c_rarg1 != arg ) {
1460 masm->mov(c_rarg1, arg);
1461 }
1462 }
1463
1464 static void pass_arg2(MacroAssembler* masm, Register arg) {
1465 if (c_rarg2 != arg ) {
1466 masm->mov(c_rarg2, arg);
1467 }
1468 }
1469
1470 void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result,
1471 address entry_point,
1472 Register arg_1,
1473 bool check_exceptions) {
1474 pass_arg1(this, arg_1);
1475 call_VM_preemptable_helper(oop_result, entry_point, 1, check_exceptions);
1476 }
1477
1478 void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result,
1479 address entry_point,
1480 Register arg_1,
1481 Register arg_2,
1482 bool check_exceptions) {
1483 LP64_ONLY(assert_different_registers(arg_1, c_rarg2));
1484 pass_arg2(this, arg_2);
1485 pass_arg1(this, arg_1);
1486 call_VM_preemptable_helper(oop_result, entry_point, 2, check_exceptions);
1487 }
1488
1489 void InterpreterMacroAssembler::restore_after_resume(bool is_native) {
1490 lea(rscratch1, ExternalAddress(Interpreter::cont_resume_interpreter_adapter()));
1491 blr(rscratch1);
1492 if (is_native) {
1493 // On resume we need to set up stack as expected
1494 push(dtos);
1495 push(ltos);
1496 }
1497 }
1498
1499 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
1500 assert_different_registers(obj, rscratch1, mdo_addr.base(), mdo_addr.index());
1501 Label update, next, none;
1502
1503 verify_oop(obj);
1504
1505 cbnz(obj, update);
1506 orptr(mdo_addr, TypeEntries::null_seen);
1507 b(next);
1508
|