From f21e47db805b56d5bf183d7a2cfba076f380612a Mon Sep 17 00:00:00 2001 From: William Kemper Date: Fri, 3 Apr 2026 21:04:52 +0000 Subject: [PATCH] 8381549: GenShen: Global collections skip coalesce and fill when the collection set is empty Reviewed-by: kdnilsen, xpeng, ysr --- .../heuristics/shenandoahGenerationalHeuristics.cpp | 4 ++-- src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp | 2 +- src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp index d5622ed5d79..45ba2740ea5 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp @@ -84,7 +84,7 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio // Choose the collection set filter_regions(collection_set); - if (!collection_set->is_empty() && _generation->is_global()) { + if (_generation->is_global()) { // We have just chosen a collection set for a global cycle. The mark bitmap covering old regions is complete, so // the remembered set scan can use that to avoid walking into garbage. When the next old mark begins, we will // use the mark bitmap to make the old regions parsable by coalescing and filling any unmarked objects. Thus, @@ -94,7 +94,7 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio // coalesce those regions. Only the old regions which are not part of the collection set at this point are // eligible for coalescing. As implemented now, this has the side effect of possibly initiating mixed-evacuations // after a global cycle for old regions that were not included in this collection set. - heap->old_generation()->prepare_for_mixed_collections_after_global_gc(); + heap->old_generation()->transition_old_generation_after_global_gc(); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp index bbfa0961e86..4ad7d2a1ae5 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp @@ -685,7 +685,7 @@ void ShenandoahOldGeneration::abandon_collection_candidates() { _old_heuristics->abandon_collection_candidates(); } -void ShenandoahOldGeneration::prepare_for_mixed_collections_after_global_gc() { +void ShenandoahOldGeneration::transition_old_generation_after_global_gc() { assert(is_mark_complete(), "Expected old generation mark to be complete after global cycle."); _old_heuristics->prepare_for_old_collections(); log_info(gc, ergo)("After choosing global collection set, mixed candidates: " UINT32_FORMAT ", coalescing candidates: %zu", diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.hpp b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.hpp index 8a356fc9b92..630736190f0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.hpp @@ -213,7 +213,7 @@ public: bool is_concurrent_mark_in_progress() override; bool entry_coalesce_and_fill(); - void prepare_for_mixed_collections_after_global_gc(); + void transition_old_generation_after_global_gc(); void prepare_gc() override; void prepare_regions_and_collection_set(bool concurrent) override; void record_success_concurrent(bool abbreviated) override;