Skip to content

Commit 8a93658

Browse files
Nityanand RaiPaul Hohensee
authored andcommitted
8371284: GenShen: Avoid unnecessary card marking
Reviewed-by: wkemper, shade, ysr
1 parent 6cbfc76 commit 8a93658

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,20 @@ inline void ShenandoahBarrierSet::keep_alive_if_weak(DecoratorSet decorators, oo
191191
template <DecoratorSet decorators, typename T>
192192
inline void ShenandoahBarrierSet::write_ref_field_post(T* field) {
193193
assert(ShenandoahCardBarrier, "Should have been checked by caller");
194+
if (_heap->is_in_young(field)) {
195+
// Young field stores do not require card mark.
196+
return;
197+
}
198+
T heap_oop = RawAccess<>::oop_load(field);
199+
if (CompressedOops::is_null(heap_oop)) {
200+
// Null reference store do not require card mark.
201+
return;
202+
}
203+
oop obj = CompressedOops::decode_not_null(heap_oop);
204+
if (!_heap->is_in_young(obj)) {
205+
// Not an old->young reference store.
206+
return;
207+
}
194208
volatile CardTable::CardValue* byte = card_table()->byte_for(field);
195209
*byte = CardTable::dirty_card_val();
196210
}

0 commit comments

Comments
 (0)