--- old/src/hotspot/share/runtime/stackValue.cpp 2020-02-06 19:18:25.004548439 +0100 +++ new/src/hotspot/share/runtime/stackValue.cpp 2020-02-06 19:18:24.837548453 +0100 @@ -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); }