RFR: 8367397: Improve naming and terminology in regmask.hpp and regmask.cpp [v4]

Daniel Lundén dlunden at openjdk.org
Fri Sep 12 12:37:27 UTC 2025


On Fri, 12 Sep 2025 12:24:45 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Daniel Lundén has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove _LogWordBits
>
> src/hotspot/share/opto/regmask.hpp line 65:
> 
>> 63:   LP64_ONLY(STATIC_ASSERT(is_aligned(RM_SIZE_IN_INTS, 2)));
>> 64: 
>> 65:   static const unsigned int _WordBitMask = BitsPerWord - 1U;
> 
> You could also remove the `_` here. I suppose we keep `CamelCase` here because to keep it parallel to `BitsPerWord`. What do you think @dean-long ?

I renamed this entire group of constants to use the same style (uppercase separated by `_`, without leading `_`). It is now `WORD_BIT_MASK`. I think it makes more sense to use the same style across `regmask.hpp`, rather than following styles in other files.

> src/hotspot/share/opto/regmask.hpp line 68:
> 
>> 66:   static const unsigned int _RM_SIZE_IN_WORDS =
>> 67:       LP64_ONLY(RM_SIZE_IN_INTS >> 1) NOT_LP64(RM_SIZE_IN_INTS);
>> 68:   static const unsigned int _RM_WORD_MAX_INDEX = _RM_SIZE_IN_WORDS - 1U;
> 
> I would get rid of the `_` here. Constants should preferrably be `UPPER_CASE` (most of the time), and occasionally `CamelCase` where we are already doing it (only do it if needed for consistency). Underscore is only used for fields, as far as I know.

Yes, I had the same thought (now updated)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27215#discussion_r2344107536
PR Review Comment: https://git.openjdk.org/jdk/pull/27215#discussion_r2344109467


More information about the hotspot-compiler-dev mailing list