@@ -429,7 +429,11 @@ void ShenandoahBarrierSet::arraycopy_barrier(T* src, T* dst, size_t count) {
429429 // If marking old or young, we must evaluate the SATB barrier. This will be the only
430430 // action if we are not marking old. If we are marking old, we must still evaluate the
431431 // load reference barrier for a young collection.
432- arraycopy_marking (dst, count);
432+ if (_heap->mode ()->is_generational ()) {
433+ arraycopy_marking<true >(dst, count);
434+ } else {
435+ arraycopy_marking<false >(dst, count);
436+ }
433437 }
434438
435439 if ((gc_state & ShenandoahHeap::EVACUATION) != 0 ) {
@@ -441,11 +445,12 @@ void ShenandoahBarrierSet::arraycopy_barrier(T* src, T* dst, size_t count) {
441445 }
442446}
443447
444- template <class T >
448+ template <bool IS_GENERATIONAL, class T >
445449void ShenandoahBarrierSet::arraycopy_marking (T* dst, size_t count) {
446450 assert (_heap->is_concurrent_mark_in_progress (), " only during marking" );
447451 if (ShenandoahSATBBarrier) {
448- if (!_heap->marking_context ()->allocated_after_mark_start (reinterpret_cast <HeapWord*>(dst))) {
452+ if (!_heap->marking_context ()->allocated_after_mark_start (reinterpret_cast <HeapWord*>(dst)) ||
453+ (IS_GENERATIONAL && _heap->heap_region_containing (dst)->is_old () && _heap->is_concurrent_young_mark_in_progress ())) {
449454 arraycopy_work<T, false , false , true >(dst, count);
450455 }
451456 }
0 commit comments