@@ -105,14 +105,8 @@ class HandlerImpl {
105105
106106 public:
107107
108- static int emit_exception_handler(C2_MacroAssembler *masm);
109108 static int emit_deopt_handler(C2_MacroAssembler* masm);
110109
111- static uint size_exception_handler() {
112- return ( 3 * 4 );
113- }
114-
115-
116110 static uint size_deopt_handler() {
117111 return ( 9 * 4 );
118112 }
@@ -876,26 +870,6 @@ uint MachUEPNode::size(PhaseRegAlloc *ra_) const {
876870
877871//=============================================================================
878872
879- // Emit exception handler code.
880- int HandlerImpl::emit_exception_handler(C2_MacroAssembler* masm) {
881- address base = __ start_a_stub(size_exception_handler());
882- if (base == nullptr) {
883- ciEnv::current()->record_failure("CodeCache is full");
884- return 0; // CodeBuffer::expand failed
885- }
886-
887- int offset = __ offset();
888-
889- // OK to trash LR, because exception blob will kill it
890- __ jump(OptoRuntime::exception_blob()->entry_point(), relocInfo::runtime_call_type, LR_tmp);
891-
892- assert(__ offset() - offset <= (int) size_exception_handler(), "overflow");
893-
894- __ end_a_stub();
895-
896- return offset;
897- }
898-
899873int HandlerImpl::emit_deopt_handler(C2_MacroAssembler* masm) {
900874 // Can't use any of the current frame's registers as we may have deopted
901875 // at a poll and everything can be live.
@@ -906,19 +880,26 @@ int HandlerImpl::emit_deopt_handler(C2_MacroAssembler* masm) {
906880 }
907881
908882 int offset = __ offset();
909- address deopt_pc = __ pc();
910883
911- __ sub(SP, SP, wordSize); // make room for saved PC
912- __ push(LR); // save LR that may be live when we get here
913- __ mov_relative_address(LR, deopt_pc);
914- __ str(LR, Address(SP, wordSize)); // save deopt PC
915- __ pop(LR); // restore LR
884+ Label start;
885+ __ bind(start);
886+
916887 __ jump(SharedRuntime::deopt_blob()->unpack(), relocInfo::runtime_call_type, noreg);
917888
889+ int entry_offset = __ offset();
890+ address deopt_pc = __ pc();
891+ // Preserve R0 and reserve space for the address of the entry point
892+ __ push(RegisterSet(R0) | RegisterSet(R1));
893+ // Store the entry point address
894+ __ mov_relative_address(R0, deopt_pc);
895+ __ str(R0, Address(SP, wordSize));
896+ __ pop(R0); // restore R0
897+ __ b(start);
898+
918899 assert(__ offset() - offset <= (int) size_deopt_handler(), "overflow");
919900
920901 __ end_a_stub();
921- return offset ;
902+ return entry_offset ;
922903}
923904
924905bool Matcher::match_rule_supported(int opcode) {
0 commit comments