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

Daniel Lundén dlunden at openjdk.org
Thu Sep 11 13:43:26 UTC 2025


On Thu, 11 Sep 2025 12:41:50 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/regmask.hpp line 78:
>> 
>>> 76:     // is something like 90+ parameters.
>>> 77:     int       _RM_INT[RM_SIZE_IN_INTS];
>>> 78:     uintptr_t _RM_WORD[_RM_SIZE_IN_WORDS];
>> 
>> Is there now still a reason to have `_` for the words and not for the ints?
>
> Generally, we use `_` for fields, but not for constants.
> Also: fields should be lower-case, so maybe `_RM_INT` -> `_rm_int`?

Thanks, I agree that it seems more consistent to use `_rm_int` and `_rm_word` instead. The missing leading underscore for `RM_SIZE_IN_INTS` highlights that it is a macro, unlike `_RM_SIZE_IN_WORDS`. Maybe this is just for historical reasons and not up to date with today's conventions? 

Do we classify constant static fields such as `_RM_SIZE_IN_WORDS` as constants or fields? I.e., do we use upper or lower case? I guess it would be `_rm_size_in_words` if considered a field and `RM_SIZE_IN_WORDS` (without the leading underscore) if considered a constant.

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

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


More information about the hotspot-compiler-dev mailing list