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

Thomas Schatzl tschatzl at openjdk.org
Thu Aug 21 09:40:56 UTC 2025


On Fri, 15 Aug 2025 13:03:17 GMT, Albert Mingkun Yang <ayang 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.

I'll remove this and post this separately.

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

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


More information about the hotspot-gc-dev mailing list