Skip to content

Commit 382f870

Browse files
author
William Kemper
committed
8357976: GenShen crash in swap_card_tables: Should be clean
Reviewed-by: kdnilsen, cslucas, ysr, xpeng
1 parent 8c760e7 commit 382f870

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,6 @@ void ShenandoahConcurrentGC::entry_reset() {
415415
msg);
416416
op_reset();
417417
}
418-
419-
if (heap->mode()->is_generational()) {
420-
heap->old_generation()->card_scan()->mark_read_table_as_clean();
421-
}
422418
}
423419

424420
void ShenandoahConcurrentGC::entry_scan_remembered_set() {
@@ -644,6 +640,10 @@ void ShenandoahConcurrentGC::op_reset() {
644640
} else {
645641
_generation->prepare_gc();
646642
}
643+
644+
if (heap->mode()->is_generational()) {
645+
heap->old_generation()->card_scan()->mark_read_table_as_clean();
646+
}
647647
}
648648

649649
class ShenandoahInitMarkUpdateRegionStateClosure : public ShenandoahHeapRegionClosure {

src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,15 @@ void ShenandoahDegenGC::op_degenerated() {
136136
heap->set_unload_classes(_generation->heuristics()->can_unload_classes() &&
137137
(!heap->mode()->is_generational() || _generation->is_global()));
138138

139-
if (heap->mode()->is_generational() && _generation->is_young()) {
140-
// Swap remembered sets for young
141-
_generation->swap_card_tables();
139+
if (heap->mode()->is_generational()) {
140+
// Clean the read table before swapping it. The end goal here is to have a clean
141+
// write table, and to have the read table updated with the previous write table.
142+
heap->old_generation()->card_scan()->mark_read_table_as_clean();
143+
144+
if (_generation->is_young()) {
145+
// Swap remembered sets for young
146+
_generation->swap_card_tables();
147+
}
142148
}
143149

144150
case _degenerated_roots:

0 commit comments

Comments
 (0)