RFR: 8367743: G1: Use named constants for G1CSetCandidateGroup group ids

Ivan Walulya iwalulya at openjdk.org
Tue Sep 16 13:09:10 UTC 2025


On Tue, 16 Sep 2025 12:08:11 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Hi all,
>> 
>>   please review this refactoring to use named constants for cset candidate group ids instead of raw integers.
>> 
>> Testing: gha, local compilation, use in another patch for weeks
>> 
>> Thanks,
>>   Thomas
>
> src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 3055:
> 
>> 3053:   size_t code_roots_bytes = r->rem_set()->code_roots_mem_size();
>> 3054:   const char* remset_type = r->rem_set()->get_short_state_str();
>> 3055:   uint cset_group_id     = G1CSetCandidateGroup::NoRemSetId;
> 
> I suggest rewriting the following lines to sth like:
> 
> 
> uint id;
> if (has_remset) {
>   id = 
> } else {
>   id = no_remset_id;
> }

I prefer initializing the variable instead of a redundant `else`, but ymmv.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27309#discussion_r2352444835


More information about the hotspot-gc-dev mailing list