diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp index 4f114690f53..20937b9d08e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp @@ -152,10 +152,19 @@ inline void ShenandoahBarrierSet::enqueue(oop obj) { template inline void ShenandoahBarrierSet::satb_barrier(T *field) { + // Uninitialized and no-keepalive stores do not need barrier. if (HasDecorator::value || HasDecorator::value) { return; } + + // Stores to weak/phantom require no barrier. The original references would + // have been enqueued in the SATB buffer by the load barrier if they were needed. + if (HasDecorator::value || + HasDecorator::value) { + return; + } + if (ShenandoahSATBBarrier && _heap->is_concurrent_mark_in_progress()) { T heap_oop = RawAccess<>::oop_load(field); if (!CompressedOops::is_null(heap_oop)) { @@ -260,6 +269,7 @@ inline void ShenandoahBarrierSet::AccessBarrier::oop_st template template inline void ShenandoahBarrierSet::AccessBarrier::oop_store_not_in_heap(T* addr, oop value) { + assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known"); oop_store_common(addr, value); }