8224522: Shenandoah should apply barriers on deoptimization jdk-13+22
authorshade
Wed, 22 May 2019 21:40:58 +0200
changeset 54995 181986c54764
parent 54994 faf89c9568bd
child 54996 3081932e7efd
child 57366 c646b256fbcc
8224522: Shenandoah should apply barriers on deoptimization Reviewed-by: rkennke, zgu
src/hotspot/share/runtime/stackValue.cpp
--- a/src/hotspot/share/runtime/stackValue.cpp	Thu May 23 00:21:39 2019 +0800
+++ b/src/hotspot/share/runtime/stackValue.cpp	Wed May 22 21:40:58 2019 +0200
@@ -32,6 +32,9 @@
 #if INCLUDE_ZGC
 #include "gc/z/zBarrier.inline.hpp"
 #endif
+#if INCLUDE_SHENANDOAHGC
+#include "gc/shenandoah/shenandoahBarrierSet.hpp"
+#endif
 
 StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv) {
   if (sv->is_location()) {
@@ -106,8 +109,15 @@
       } else {
         value.noop = *(narrowOop*) value_addr;
       }
-      // Decode narrowoop and wrap a handle around the oop
-      Handle h(Thread::current(), CompressedOops::decode(value.noop));
+      // Decode narrowoop
+      oop val = CompressedOops::decode(value.noop);
+      // Deoptimization must make sure all oops have passed load barriers
+#if INCLUDE_SHENANDOAHGC
+      if (UseShenandoahGC) {
+        val = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(val);
+      }
+#endif
+      Handle h(Thread::current(), val); // Wrap a handle around the oop
       return new StackValue(h);
     }
 #endif
@@ -122,13 +132,17 @@
          val = (oop)NULL;
       }
 #endif
+      // Deoptimization must make sure all oops have passed load barriers
 #if INCLUDE_ZGC
-      // Deoptimization must make sure all oop have passed load barrier
       if (UseZGC) {
         val = ZBarrier::load_barrier_on_oop_field_preloaded((oop*)value_addr, val);
       }
 #endif
-
+#if INCLUDE_SHENANDOAHGC
+      if (UseShenandoahGC) {
+        val = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(val);
+      }
+#endif
       Handle h(Thread::current(), val); // Wrap a handle around the oop
       return new StackValue(h);
     }