RFR: 8365034: G1: Remove num_groups_selected in G1CollectionSet::select_candidates_from_optional_groups as it is unnecessary

Albert Mingkun Yang ayang at openjdk.org
Fri Aug 15 13:06:12 UTC 2025


On Thu, 7 Aug 2025 10:33:59 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   please review this removal of the local `num_selected_regions` from `G1CollectionSet::select_candidates_from_optional_groups()` - the same information is maintained within the local `selected_groups` list.
> 
> Testing: gha
> 
> Thanks,
>   Thomas

src/hotspot/share/gc/g1/g1CollectionSet.cpp line 501:

> 499:   uint num_initial_regions = 0;
> 500:   uint prev_num_optional_regions = _optional_groups.num_regions();
> 501:   guarantee(prev_num_optional_regions == 0, "must be, why else?");

Why so? Can't there be any optional regions when populating cset from marking?

Also, seems not very related to this PR.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26674#discussion_r2278954081


More information about the hotspot-gc-dev mailing list