8224522: Shenandoah should apply barriers on deoptimization

Reviewed-by: rkennke, zgu
This commit is contained in:
Aleksey Shipilev 2019-05-22 21:40:58 +02:00
parent daeec1c7d1
commit 22dfc6db04

View File

@ -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 @@ StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* r
} 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 @@ StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* r
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);
}