@@ -152,10 +152,19 @@ inline void ShenandoahBarrierSet::enqueue(oop obj) {
152
152
153
153
template <DecoratorSet decorators, typename T>
154
154
inline void ShenandoahBarrierSet::satb_barrier (T *field) {
155
+ // Uninitialized and no-keepalive stores do not need barrier.
155
156
if (HasDecorator<decorators, IS_DEST_UNINITIALIZED>::value ||
156
157
HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
157
158
return ;
158
159
}
160
+
161
+ // Stores to weak/phantom require no barrier. The original references would
162
+ // have been enqueued in the SATB buffer by the load barrier if they were needed.
163
+ if (HasDecorator<decorators, ON_WEAK_OOP_REF>::value ||
164
+ HasDecorator<decorators, ON_PHANTOM_OOP_REF>::value) {
165
+ return ;
166
+ }
167
+
159
168
if (ShenandoahSATBBarrier && _heap->is_concurrent_mark_in_progress ()) {
160
169
T heap_oop = RawAccess<>::oop_load (field);
161
170
if (!CompressedOops::is_null (heap_oop)) {
@@ -260,6 +269,7 @@ inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_st
260
269
template <DecoratorSet decorators, typename BarrierSetT>
261
270
template <typename T>
262
271
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_not_in_heap(T* addr, oop value) {
272
+ assert ((decorators & ON_UNKNOWN_OOP_REF) == 0 , " Reference strength must be known" );
263
273
oop_store_common (addr, value);
264
274
}
265
275
0 commit comments