Clean the read table before swapping during a degenerated cycle

This commit is contained in:
William Kemper 2025-06-10 12:06:42 -07:00
parent a2743bab4f
commit 16003772d9
2 changed files with 13 additions and 7 deletions

View File

@ -415,10 +415,6 @@ void ShenandoahConcurrentGC::entry_reset() {
msg); msg);
op_reset(); op_reset();
} }
if (heap->mode()->is_generational()) {
heap->old_generation()->card_scan()->mark_read_table_as_clean();
}
} }
void ShenandoahConcurrentGC::entry_scan_remembered_set() { void ShenandoahConcurrentGC::entry_scan_remembered_set() {
@ -644,6 +640,10 @@ void ShenandoahConcurrentGC::op_reset() {
} else { } else {
_generation->prepare_gc(); _generation->prepare_gc();
} }
if (heap->mode()->is_generational()) {
heap->old_generation()->card_scan()->mark_read_table_as_clean();
}
} }
class ShenandoahInitMarkUpdateRegionStateClosure : public ShenandoahHeapRegionClosure { class ShenandoahInitMarkUpdateRegionStateClosure : public ShenandoahHeapRegionClosure {

View File

@ -136,9 +136,15 @@ void ShenandoahDegenGC::op_degenerated() {
heap->set_unload_classes(_generation->heuristics()->can_unload_classes() && heap->set_unload_classes(_generation->heuristics()->can_unload_classes() &&
(!heap->mode()->is_generational() || _generation->is_global())); (!heap->mode()->is_generational() || _generation->is_global()));
if (heap->mode()->is_generational() && _generation->is_young()) { if (heap->mode()->is_generational()) {
// Swap remembered sets for young // Clean the read table before swapping it. The end goal here is to have a clean
_generation->swap_card_tables(); // write table, and to have the read table updated with the previous write table.
heap->old_generation()->card_scan()->mark_read_table_as_clean();
if (_generation->is_young()) {
// Swap remembered sets for young
_generation->swap_card_tables();
}
} }
case _degenerated_roots: case _degenerated_roots: