@@ -553,84 +553,39 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
553
553
__ bind (L);
554
554
}
555
555
#endif
556
- __ reset_last_Java_frame (true );
557
- __ maybe_isb ();
558
-
559
- // check for pending exceptions
560
- { Label L;
561
- __ ldr (rscratch1, Address (rthread, Thread::pending_exception_offset ()));
562
- __ cbz (rscratch1, L);
563
- // exception pending => remove activation and forward to exception handler
564
-
565
- { Label L1;
566
- __ cbnz (r0, L1); // have we deoptimized?
567
- __ far_jump (RuntimeAddress (Runtime1::entry_for (Runtime1::forward_exception_id)));
568
- __ bind (L1);
569
- }
570
-
571
- // the deopt blob expects exceptions in the special fields of
572
- // JavaThread, so copy and clear pending exception.
573
-
574
- // load and clear pending exception
575
- __ ldr (r0, Address (rthread, Thread::pending_exception_offset ()));
576
- __ str (zr, Address (rthread, Thread::pending_exception_offset ()));
577
-
578
- // check that there is really a valid exception
579
- __ verify_not_null_oop (r0);
580
556
581
- // load throwing pc: this is the return address of the stub
582
- __ mov (r3, lr);
557
+ __ reset_last_Java_frame (true );
583
558
584
559
#ifdef ASSERT
585
- // check that fields in JavaThread for exception oop and issuing pc are empty
586
- Label oop_empty;
587
- __ ldr (rscratch1, Address (rthread, Thread::pending_exception_offset ()));
588
- __ cbz (rscratch1, oop_empty);
589
- __ stop (" exception oop must be empty" );
590
- __ bind (oop_empty);
591
-
592
- Label pc_empty;
593
- __ ldr (rscratch1, Address (rthread, JavaThread::exception_pc_offset ()));
594
- __ cbz (rscratch1, pc_empty);
595
- __ stop (" exception pc must be empty" );
596
- __ bind (pc_empty);
597
- #endif
598
-
599
- // store exception oop and throwing pc to JavaThread
600
- __ str (r0, Address (rthread, JavaThread::exception_oop_offset ()));
601
- __ str (r3, Address (rthread, JavaThread::exception_pc_offset ()));
602
-
603
- restore_live_registers (sasm);
604
-
605
- __ leave ();
606
-
607
- // Forward the exception directly to deopt blob. We can blow no
608
- // registers and must leave throwing pc on the stack. A patch may
609
- // have values live in registers so the entry point with the
610
- // exception in tls.
611
- __ far_jump (RuntimeAddress (deopt_blob->unpack_with_exception_in_tls ()));
612
-
613
- __ bind (L);
614
- }
615
-
616
-
617
- // Runtime will return true if the nmethod has been deoptimized during
618
- // the patching process. In that case we must do a deopt reexecute instead.
560
+ // check that fields in JavaThread for exception oop and issuing pc are empty
561
+ Label oop_empty;
562
+ __ ldr (rscratch1, Address (rthread, Thread::pending_exception_offset ()));
563
+ __ cbz (rscratch1, oop_empty);
564
+ __ stop (" exception oop must be empty" );
565
+ __ bind (oop_empty);
619
566
620
- Label cont;
567
+ Label pc_empty;
568
+ __ ldr (rscratch1, Address (rthread, JavaThread::exception_pc_offset ()));
569
+ __ cbz (rscratch1, pc_empty);
570
+ __ stop (" exception pc must be empty" );
571
+ __ bind (pc_empty);
572
+ #endif
621
573
622
- __ cbz (r0, cont); // have we deoptimized?
574
+ // Runtime will return true if the nmethod has been deoptimized, this is the
575
+ // expected scenario and anything else is an error. Note that we maintain a
576
+ // check on the result purely as a defensive measure.
577
+ Label no_deopt;
578
+ __ cbz (r0, no_deopt); // Have we deoptimized?
623
579
624
- // Will reexecute. Proper return address is already on the stack we just restore
625
- // registers, pop all of our frame but the return address and jump to the deopt blob
580
+ // Perform a re-execute. The proper return address is already on the stack,
581
+ // we just need to restore registers, pop all of our frame but the return
582
+ // address and jump to the deopt blob.
626
583
restore_live_registers (sasm);
627
584
__ leave ();
628
585
__ far_jump (RuntimeAddress (deopt_blob->unpack_with_reexecution ()));
629
586
630
- __ bind (cont);
631
- restore_live_registers (sasm);
632
- __ leave ();
633
- __ ret (lr);
587
+ __ bind (no_deopt);
588
+ __ stop (" deopt not performed" );
634
589
635
590
return oop_maps;
636
591
}
0 commit comments