420
421 #ifndef PRODUCT
422 // tell the simulator that the method has been reentered
423 if (NotifySimulator) {
424 __ notify(Assembler::method_reentry);
425 }
426 #endif
427 __ get_dispatch();
428 __ dispatch_next(state, step);
429
430 return entry;
431 }
432
433 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
434 int step) {
435 address entry = __ pc();
436 __ restore_bcp();
437 __ restore_locals();
438 __ restore_constant_pool_cache();
439 __ get_method(rmethod);
440
441 #if INCLUDE_JVMCI
442 // Check if we need to take lock at entry of synchronized method.
443 if (UseJVMCICompiler) {
444 Label L;
445 __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
446 __ cbz(rscratch1, L);
447 // Clear flag.
448 __ strb(zr, Address(rthread, JavaThread::pending_monitorenter_offset()));
449 // Take lock.
450 lock_method();
451 __ bind(L);
452 }
453 #endif
454 // handle exceptions
455 {
456 Label L;
457 __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
458 __ cbz(rscratch1, L);
459 __ call_VM(noreg,
460 CAST_FROM_FN_PTR(address,
461 InterpreterRuntime::throw_pending_exception));
462 __ should_not_reach_here();
463 __ bind(L);
464 }
465
466 __ get_dispatch();
467
468 // Calculate stack limit
469 __ ldr(rscratch1, Address(rmethod, Method::const_offset()));
470 __ ldrh(rscratch1, Address(rscratch1, ConstMethod::max_stack_offset()));
471 __ add(rscratch1, rscratch1, frame::interpreter_frame_monitor_size() + 2);
472 __ ldr(rscratch2,
473 Address(rfp, frame::interpreter_frame_initial_sp_offset * wordSize));
474 __ sub(rscratch1, rscratch2, rscratch1, ext::uxtx, 3);
475 __ andr(sp, rscratch1, -16);
476
477 // Restore expression stack pointer
478 __ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
479 // NULL last_sp until next java call
480 __ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
481
482 __ dispatch_next(state, step);
483 return entry;
484 }
485
486 address TemplateInterpreterGenerator::generate_result_handler_for(
487 BasicType type) {
488 address entry = __ pc();
489 switch (type) {
490 case T_BOOLEAN: __ uxtb(r0, r0); break;
491 case T_CHAR : __ uxth(r0, r0); break;
492 case T_BYTE : __ sxtb(r0, r0); break;
493 case T_SHORT : __ sxth(r0, r0); break;
494 case T_INT : __ uxtw(r0, r0); break; // FIXME: We almost certainly don't need this
495 case T_LONG : /* nothing to do */ break;
496 case T_VOID : /* nothing to do */ break;
497 case T_FLOAT : /* nothing to do */ break;
498 case T_DOUBLE : /* nothing to do */ break;
499 case T_OBJECT :
500 // retrieve result from frame
|
420
421 #ifndef PRODUCT
422 // tell the simulator that the method has been reentered
423 if (NotifySimulator) {
424 __ notify(Assembler::method_reentry);
425 }
426 #endif
427 __ get_dispatch();
428 __ dispatch_next(state, step);
429
430 return entry;
431 }
432
433 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
434 int step) {
435 address entry = __ pc();
436 __ restore_bcp();
437 __ restore_locals();
438 __ restore_constant_pool_cache();
439 __ get_method(rmethod);
440 __ get_dispatch();
441
442 // Calculate stack limit
443 __ ldr(rscratch1, Address(rmethod, Method::const_offset()));
444 __ ldrh(rscratch1, Address(rscratch1, ConstMethod::max_stack_offset()));
445 __ add(rscratch1, rscratch1, frame::interpreter_frame_monitor_size() + 2);
446 __ ldr(rscratch2,
447 Address(rfp, frame::interpreter_frame_initial_sp_offset * wordSize));
448 __ sub(rscratch1, rscratch2, rscratch1, ext::uxtx, 3);
449 __ andr(sp, rscratch1, -16);
450
451 // Restore expression stack pointer
452 __ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
453 // NULL last_sp until next java call
454 __ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
455
456 #if INCLUDE_JVMCI
457 // Check if we need to take lock at entry of synchronized method.
458 if (UseJVMCICompiler) {
459 Label L;
460 __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
461 __ cbz(rscratch1, L);
462 // Clear flag.
463 __ strb(zr, Address(rthread, JavaThread::pending_monitorenter_offset()));
464 // Take lock.
465 lock_method();
466 __ bind(L);
467 }
468 #endif
469 // handle exceptions
470 {
471 Label L;
472 __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
473 __ cbz(rscratch1, L);
474 __ call_VM(noreg,
475 CAST_FROM_FN_PTR(address,
476 InterpreterRuntime::throw_pending_exception));
477 __ should_not_reach_here();
478 __ bind(L);
479 }
480
481 __ dispatch_next(state, step);
482 return entry;
483 }
484
485 address TemplateInterpreterGenerator::generate_result_handler_for(
486 BasicType type) {
487 address entry = __ pc();
488 switch (type) {
489 case T_BOOLEAN: __ uxtb(r0, r0); break;
490 case T_CHAR : __ uxth(r0, r0); break;
491 case T_BYTE : __ sxtb(r0, r0); break;
492 case T_SHORT : __ sxth(r0, r0); break;
493 case T_INT : __ uxtw(r0, r0); break; // FIXME: We almost certainly don't need this
494 case T_LONG : /* nothing to do */ break;
495 case T_VOID : /* nothing to do */ break;
496 case T_FLOAT : /* nothing to do */ break;
497 case T_DOUBLE : /* nothing to do */ break;
498 case T_OBJECT :
499 // retrieve result from frame
|