changeset 54995:181986c54764 jdk-13+22

8224522: Shenandoah should apply barriers on deoptimization Reviewed-by: rkennke, zgu
author shade
date Wed, 22 May 2019 21:40:58 +0200
parents faf89c9568bd
children 3081932e7efd
files src/hotspot/share/runtime/stackValue.cpp
diffstat 1 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }