8202676: AArch64: Missing enter/leave around barrier leads to infinite loop
authorrkennke
Sun, 06 May 2018 00:42:59 +0200
changeset 50024 7238cb613dc5
parent 50023 bdb627563075
child 50025 caf05d64138f
child 56535 532bc255382f
8202676: AArch64: Missing enter/leave around barrier leads to infinite loop Reviewed-by: aph, eosterlund
src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp
src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp
src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
--- a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp	Sat May 05 22:19:19 2018 +0200
+++ b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp	Sun May 06 00:42:59 2018 +0200
@@ -259,6 +259,8 @@
   bool on_reference = on_weak || on_phantom;
   ModRefBarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread);
   if (on_oop && on_reference) {
+    // LR is live.  It must be saved around calls.
+    __ enter(); // barrier may call runtime
     // Generate the G1 pre-barrier code to log the value of
     // the referent field in an SATB buffer.
     g1_write_barrier_pre(masm /* masm */,
@@ -268,6 +270,7 @@
                          tmp1 /* tmp */,
                          true /* tosca_live */,
                          true /* expand_call */);
+    __ leave();
   }
 }
 
--- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp	Sat May 05 22:19:19 2018 +0200
+++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp	Sun May 06 00:42:59 2018 +0200
@@ -30,6 +30,9 @@
 
 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                                   Register dst, Address src, Register tmp1, Register tmp_thread) {
+
+  // LR is live.  It must be saved around calls.
+
   bool on_heap = (decorators & IN_HEAP) != 0;
   bool on_root = (decorators & IN_ROOT) != 0;
   switch (type) {
--- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp	Sat May 05 22:19:19 2018 +0200
+++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp	Sun May 06 00:42:59 2018 +0200
@@ -918,6 +918,8 @@
   // rmethod: Method*
   // r13: senderSP must preserve for slow path, set SP to it on fast path
 
+  // LR is live.  It must be saved around calls.
+
   address entry = __ pc();
 
   const int referent_offset = java_lang_ref_Reference::referent_offset;