RFR: 8325467: Support methods with many arguments in C2 [v24]

Daniel Lundén dlunden at openjdk.org
Mon Sep 8 16:23:29 UTC 2025


On Tue, 2 Sep 2025 14:38:45 GMT, Daniel Lundén <dlunden at openjdk.org> wrote:

>> Hmm ok. Now I went to `rm_up` and thought that you would do `i - _offset`. But that's not what happens.
>> 
>> Hmm but then here there is a subtraction:
>> 
>>   bool Member(OptoReg::Name reg) const {
>>     reg = reg - offset_bits();
>> 
>> 
>> Is that consistent? I hope you understand why I'm confused 😅
>
> Yes, the subtraction is consistent, because if the register mask is offset, we can no longer use the OptoReg to directly index the mask. Small simplified example: register mask with 5 bits, offset by 10. First bit (index 0) represents OptoReg 10, second bit (index 1) represents OptoReg 11, etc. If we call `Member(15)`, we need to subtract the offset so we look at the correct index in the register mask (index 5).

Ah, I think I now better understand your question. `rm_up` is a low-level method for internal use in `regmask.hpp` and `regmask.cpp` only (perhaps I should prepend it with an underscore?). It basically makes it so that we can regard the backing storage (`_RM_UP` and `_RM_UP_EXT`) as one contiguous array. `Member` is exposed externally and so needs the offset logic.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20404#discussion_r2330742374


More information about the hotspot-compiler-dev mailing list