< prev index next >

src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp

Print this page
rev 8300 : 8079564: Use FP register as proper frame pointer in JIT compiled code on aarch64
Summary: Add support for PreserveFramePointer for debug/profile
Reviewed-by: duke


 426   oop_maps->add_gc_map(call_offset, oop_map);
 427 
 428   // r0: handler address
 429   //      will be the deopt blob if nmethod was deoptimized while we looked up
 430   //      handler regardless of whether handler existed in the nmethod.
 431 
 432   // only r0 is valid at this time, all other registers have been destroyed by the runtime call
 433   __ invalidate_registers(false, true, true, true, true, true);
 434 
 435   // patch the return address, this stub will directly return to the exception handler
 436   __ str(r0, Address(rfp, 1*BytesPerWord));
 437 
 438   switch (id) {
 439   case forward_exception_id:
 440   case handle_exception_nofpu_id:
 441   case handle_exception_id:
 442     // Restore the registers that were saved at the beginning.
 443     restore_live_registers(sasm, id != handle_exception_nofpu_id);
 444     break;
 445   case handle_exception_from_callee_id:
 446     // Pop the return address since we are possibly changing SP (restoring from BP).
 447     __ leave();
 448 
 449     // Restore SP from FP if the exception PC is a method handle call site.
 450     {
 451       Label nope;
 452       __ ldrw(rscratch1, Address(rthread, JavaThread::is_method_handle_return_offset()));
 453       __ cbzw(rscratch1, nope);
 454       __ mov(sp, rfp);
 455       __ bind(nope);
 456     }
 457 
 458     __ ret(lr);  // jump to exception handler
 459     break;
 460   default:  ShouldNotReachHere();
 461   }
 462 
 463   return oop_maps;
 464 }
 465 
 466 
 467 void Runtime1::generate_unwind_exception(StubAssembler *sasm) {
 468   // incoming parameters
 469   const Register exception_oop = r0;
 470   // callee-saved copy of exception_oop during runtime call
 471   const Register exception_oop_callee_saved = r19;
 472   // other registers used in this stub
 473   const Register exception_pc = r3;
 474   const Register handler_addr = r1;
 475 
 476   // verify that only r0, is valid at this time
 477   __ invalidate_registers(false, true, true, true, true, true);


 496   // save exception_oop
 497   __ stp(lr, exception_oop, Address(__ pre(sp, -2 * wordSize)));
 498 
 499   // search the exception handler address of the caller (using the return address)
 500   __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), rthread, lr);
 501   // r0: exception handler address of the caller
 502 
 503   // Only R0 is valid at this time; all other registers have been
 504   // destroyed by the call.
 505   __ invalidate_registers(false, true, true, true, false, true);
 506 
 507   // move result of call into correct register
 508   __ mov(handler_addr, r0);
 509 
 510   // get throwing pc (= return address).
 511   // lr has been destroyed by the call
 512   __ ldp(lr, exception_oop, Address(__ post(sp, 2 * wordSize)));
 513   __ mov(r3, lr);
 514 
 515   __ verify_not_null_oop(exception_oop);
 516 
 517   {
 518     Label foo;
 519     __ ldrw(rscratch1, Address(rthread, JavaThread::is_method_handle_return_offset()));
 520     __ cbzw(rscratch1, foo);
 521     __ mov(sp, rfp);
 522     __ bind(foo);
 523   }
 524 
 525   // continue at exception handler (return address removed)
 526   // note: do *not* remove arguments when unwinding the
 527   //       activation since the caller assumes having
 528   //       all arguments on the stack when entering the
 529   //       runtime to determine the exception handler
 530   //       (GC happens at call site with arguments!)
 531   // r0: exception oop
 532   // r3: throwing pc
 533   // r1: exception handler
 534   __ br(handler_addr);
 535 }
 536 
 537 
 538 
 539 OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
 540   // use the maximum number of runtime-arguments here because it is difficult to
 541   // distinguish each RT-Call.
 542   // Note: This number affects also the RT-Call in generate_handle_exception because
 543   //       the oop-map is shared for all calls.




 426   oop_maps->add_gc_map(call_offset, oop_map);
 427 
 428   // r0: handler address
 429   //      will be the deopt blob if nmethod was deoptimized while we looked up
 430   //      handler regardless of whether handler existed in the nmethod.
 431 
 432   // only r0 is valid at this time, all other registers have been destroyed by the runtime call
 433   __ invalidate_registers(false, true, true, true, true, true);
 434 
 435   // patch the return address, this stub will directly return to the exception handler
 436   __ str(r0, Address(rfp, 1*BytesPerWord));
 437 
 438   switch (id) {
 439   case forward_exception_id:
 440   case handle_exception_nofpu_id:
 441   case handle_exception_id:
 442     // Restore the registers that were saved at the beginning.
 443     restore_live_registers(sasm, id != handle_exception_nofpu_id);
 444     break;
 445   case handle_exception_from_callee_id:
 446     // Pop the return address.
 447     __ leave();










 448     __ ret(lr);  // jump to exception handler
 449     break;
 450   default:  ShouldNotReachHere();
 451   }
 452 
 453   return oop_maps;
 454 }
 455 
 456 
 457 void Runtime1::generate_unwind_exception(StubAssembler *sasm) {
 458   // incoming parameters
 459   const Register exception_oop = r0;
 460   // callee-saved copy of exception_oop during runtime call
 461   const Register exception_oop_callee_saved = r19;
 462   // other registers used in this stub
 463   const Register exception_pc = r3;
 464   const Register handler_addr = r1;
 465 
 466   // verify that only r0, is valid at this time
 467   __ invalidate_registers(false, true, true, true, true, true);


 486   // save exception_oop
 487   __ stp(lr, exception_oop, Address(__ pre(sp, -2 * wordSize)));
 488 
 489   // search the exception handler address of the caller (using the return address)
 490   __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), rthread, lr);
 491   // r0: exception handler address of the caller
 492 
 493   // Only R0 is valid at this time; all other registers have been
 494   // destroyed by the call.
 495   __ invalidate_registers(false, true, true, true, false, true);
 496 
 497   // move result of call into correct register
 498   __ mov(handler_addr, r0);
 499 
 500   // get throwing pc (= return address).
 501   // lr has been destroyed by the call
 502   __ ldp(lr, exception_oop, Address(__ post(sp, 2 * wordSize)));
 503   __ mov(r3, lr);
 504 
 505   __ verify_not_null_oop(exception_oop);








 506 
 507   // continue at exception handler (return address removed)
 508   // note: do *not* remove arguments when unwinding the
 509   //       activation since the caller assumes having
 510   //       all arguments on the stack when entering the
 511   //       runtime to determine the exception handler
 512   //       (GC happens at call site with arguments!)
 513   // r0: exception oop
 514   // r3: throwing pc
 515   // r1: exception handler
 516   __ br(handler_addr);
 517 }
 518 
 519 
 520 
 521 OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
 522   // use the maximum number of runtime-arguments here because it is difficult to
 523   // distinguish each RT-Call.
 524   // Note: This number affects also the RT-Call in generate_handle_exception because
 525   //       the oop-map is shared for all calls.


< prev index next >