< prev index next >

src/hotspot/share/runtime/stackValue.cpp

Print this page
rev 52801 : Upstream/backport Shenandoah to JDK11u
* * *
[backport] 8237570: Shenandoah: cleanup uses of allocation/free threshold in static heuristics
Reviewed-by: rkennke

@@ -30,10 +30,13 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/stackValue.hpp"
 #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()) {
     // Stack or register value
     Location loc = ((LocationValue *)sv)->location();

@@ -104,12 +107,19 @@
         // saved long to the int that the JVM wants.
         value.noop =  (narrowOop) *(julong*) value_addr;
       } 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
     case Location::oop: {
       oop val = *(oop *)value_addr;

@@ -120,17 +130,21 @@
          // The narrow_oop_base could be NULL or be the address
          // of the page below heap. Use NULL value for both cases.
          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);
     }
     case Location::addr: {
       ShouldNotReachHere(); // both C1 and C2 now inline jsrs
< prev index next >