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

Emanuel Peter epeter at openjdk.org
Tue Sep 2 14:19:02 UTC 2025


On Mon, 1 Sep 2025 16:23:57 GMT, Daniel Lundén <dlunden at openjdk.org> wrote:

>> src/hotspot/share/opto/regmask.hpp line 96:
>> 
>>> 94:       (((RM_SIZE_MIN << 5) +                // Slots for machine registers
>>> 95:         (max_method_parameter_length * 2) + // Slots for incoming arguments
>>> 96:         (max_method_parameter_length * 2) + // Slots for outgoing arguments
>> 
>> What's the meaning of incoming vs outgoing arguments? Like this?
>> 
>> Incoming = from caller (outer nesting)
>> Outgoing = to nested call (inner nesting)
>
> Yes, you are correct. There is a detailed explanation in `x86_64.ad` ("Definition of frame structure and management information").

Ok. But that's not immediately apparent here. If you already have a comment, why not mention caller/callee or inner/outer scope?

>> src/hotspot/share/opto/regmask.hpp line 175:
>> 
>>> 173:   // mask can currently represent to be included. If _all_stack = false, we
>>> 174:   // consider the registers not included.
>>> 175:   bool _all_stack = false;
>> 
>> I'd prefer to have some kind of `_is_...` name here. Because when I read `all_stack` and see it is a bool, I wonder what it means - it does not tell me quickly. Does it mean that all registers are on the stack?
>> 
>> Is everything that is beyond the register mask purely on the stack? Is everything from the stack always beyond the register mask? I'm confused :face_with_peeking_eye:
>
> Right, we should probably update this terminology as well. It comes from the fact that register masks can always represent all registers (+ a few stack slots), and anything beyond the mask is necessarily additional stack slots. So, if `_all_stack` is set, it means the register mask includes all of the stack slots. Any suggestion for a better name?

So that could mean that we have stack slots that are in the mask, and that are off, but we still have `_all_stack = true`, right? That sounds a little contradictory to me.

Some ideas:
- `_value_of_bits_above_mask` - though strictly speaking the mask also represents those bits, and so they are not really "above" the mask.
- `_value_of_bits_above_...` ah it is above the register mask `size`, right? Of course it is a bit suboptimal that the `size` is only for those that we explicitly represent, and does not capture that we implicitly represent. Maybe you can think about naming here too. Optional.

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

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


More information about the hotspot-compiler-dev mailing list