Skip to content

Commit c9ab330

Browse files
author
Xiaolong Peng
committed
8373116: Genshen: arraycopy_work should be always done for arrays in old gen during young concurrent marking
8372498: [genshen] gc/TestAllocHumongousFragment.java#generational causes intermittent SIGSEGV crashes Reviewed-by: wkemper, kdnilsen
1 parent 3ea82b9 commit c9ab330

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ class ShenandoahBarrierSet: public BarrierSet {
128128
void write_ref_array(HeapWord* start, size_t count);
129129

130130
private:
131-
template <class T>
132-
inline void arraycopy_marking(T* dst, size_t count);
131+
template <bool IS_GENERATIONAL, class T>
132+
void arraycopy_marking(T* dst, size_t count);
133133
template <class T>
134134
inline void arraycopy_evacuation(T* src, size_t count);
135135
template <class T>

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
445449
void 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

Comments
 (0)