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

Daniel Lundén dlunden at openjdk.org
Mon Sep 1 16:30:00 UTC 2025


On Mon, 1 Sep 2025 08:15:53 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Daniel Lundén has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 35 commits:
>> 
>>  - Restore modified java/lang/invoke tests
>>  - Sort includes (new requirement)
>>  - Merge remote-tracking branch 'upstream/master' into many-arguments-8325467+pr-updates
>>  - Add clarifying comments at definitions of register mask sizes
>>  - Fix implicit zero and nullptr checks
>>  - Add deep copy comment
>>  - Merge remote-tracking branch 'upstream/master' into many-arguments-8325467+pr-updates
>>  - Fix typo
>>  - Updates after Emanuel's comments
>>  - Refactor and improve TestNestedSynchronize.java
>>  - ... and 25 more: https://git.openjdk.org/jdk/compare/b39c7369...80c6cf47
>
> 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").

> 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?

> src/hotspot/share/opto/regmask.hpp line 179:
> 
>> 177:   // The low and high watermarks represent the lowest and highest word that
>> 178:   // might contain set register mask bits, respectively. We guarantee that
>> 179:   // there are no bits in words outside this range, but any word at and between
> 
> In the example below, you have 1 bits above the `_hwm`. Is that intentional? Are those bits to be ignored? Can you please add some extra info to the example about that?

Right, `_lwm` and `_hwm` does not apply for `_all_stack` bits. I'll clarify!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20404#discussion_r2314315615
PR Review Comment: https://git.openjdk.org/jdk/pull/20404#discussion_r2314312930
PR Review Comment: https://git.openjdk.org/jdk/pull/20404#discussion_r2314317882


More information about the hotspot-compiler-dev mailing list