RFR: 8342156: C2: Compilation failure with fewer arguments after JDK-8329032
Daniel Lundén
dlunden at openjdk.org
Tue Oct 22 07:04:10 UTC 2024
On Mon, 21 Oct 2024 14:05:54 GMT, Daniel Lundén <dlunden at openjdk.org> wrote:
> Adding C2 register allocation support for APX EGPRs ([JDK-8329032](https://bugs.openjdk.org/browse/JDK-8329032)) reduced, due to unfortunate rounding in the register mask size computation, the available space for incoming/outgoing method arguments in register masks.
>
> ### Changeset
>
> - Bump the number of 32-bit words dedicated to incoming/outgoing arguments in register masks from 3 to 4.
> - Add a regression test.
>
> ### Testing
>
> - [GitHub Actions](https://github.com/dlunde/jdk/actions/runs/11436050131)
> - `tier1` to `tier4` (and additional Oracle-internal testing) on Windows x64, Linux x64, Linux aarch64, macOS x64, and macOS aarch64.
> - C2 compilation time benchmarking for DaCapo on Windows x64, Linux x64, Linux aarch64, macOS x64, and macOS aarch64. There is no observable difference in C2 compilation time.
This is a general problem and neither `UseAPX`, `number_of_registers`, nor `available_gp_registers` influence the static register mask size computation. Instead, the register mask size computation uses `RegisterForm::_reg_ctr` which we increment as we encounter registers during ADL parsing.
I have summarized the rounding issue in more detail in JBS, but pasting it below as well for convenience.
> The addition of the new APX registers results in less available space in register masks for method arguments. The (static) register mask size computation in RegisterForm::RegMask_Size does take the number of available registers into account, but also rounds up to an even number of 32-bit words. Specifically, the register mask size computation is
>
> (words_for_regs + 3 + 1) & ~1;
>
> Adding the new APX registers correctly bumps `words_for_regs` from 18 to 19, but due to the rounding, the result is the same (22) as for a value of 18 for `words_for_regs`.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21612#issuecomment-2428417102
More information about the hotspot-compiler-dev
mailing list