diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp index 2b5bc766a462a..7db478a781a72 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp @@ -128,8 +128,8 @@ class ShenandoahBarrierSet: public BarrierSet { void write_ref_array(HeapWord* start, size_t count); private: - template - inline void arraycopy_marking(T* dst, size_t count); + template + void arraycopy_marking(T* dst, size_t count); template inline void arraycopy_evacuation(T* src, size_t count); template diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp index adeea8ebf9613..199256ca31b5e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp @@ -429,7 +429,11 @@ void ShenandoahBarrierSet::arraycopy_barrier(T* src, T* dst, size_t count) { // If marking old or young, we must evaluate the SATB barrier. This will be the only // action if we are not marking old. If we are marking old, we must still evaluate the // load reference barrier for a young collection. - arraycopy_marking(dst, count); + if (_heap->mode()->is_generational()) { + arraycopy_marking(dst, count); + } else { + arraycopy_marking(dst, count); + } } if ((gc_state & ShenandoahHeap::EVACUATION) != 0) { @@ -441,11 +445,12 @@ void ShenandoahBarrierSet::arraycopy_barrier(T* src, T* dst, size_t count) { } } -template +template void ShenandoahBarrierSet::arraycopy_marking(T* dst, size_t count) { assert(_heap->is_concurrent_mark_in_progress(), "only during marking"); if (ShenandoahSATBBarrier) { - if (!_heap->marking_context()->allocated_after_mark_start(reinterpret_cast(dst))) { + if (!_heap->marking_context()->allocated_after_mark_start(reinterpret_cast(dst)) || + (IS_GENERATIONAL && _heap->heap_region_containing(dst)->is_old() && _heap->is_concurrent_young_mark_in_progress())) { arraycopy_work(dst, count); } }