RFR: 8268858: Determine register pressure automatically by the number of available registers for allocation

Vladimir Kozlov kvn at openjdk.java.net
Thu Jun 17 17:13:31 UTC 2021


On Wed, 16 Jun 2021 04:20:31 GMT, Joshua Zhu <jzhu at openjdk.org> wrote:

> Hi,
> 
> This patch includes the following changes:
> 
> 1) Determine register pressure automatically by the number of available
>    registers for allocation.
>    Currently, INTPRESSURE is hard-coded no matter whether heapbase
>    or framepointer register is available for RA.
> 
> 2) x86: Machines with AVX3 have 2x more XMM registers.
>         The pressure threshold should be improved for both RA and LCM.
>         Currently, only scheduling takes more XMM registers into
>         consideration.
> 
> 3) aarch64: add a new jtreg case
>         In bug 8183543, this case caused many compilation failures with
>         "failed spill-split-recycle sanity check". This test case is
>         imported to ensure no regression failure.
> 
> Inconsistent pressure threshold value with the number of available
> registers will bring unnecessary spilling in some scenarios.
> I wrote a simple example as one case:
>   https://cr.openjdk.java.net/~jzhu/8268858/Test.java
> 
> With this patch, 4 extra spill copies are eliminated on AArch64.
>   old OptoAssembly: https://cr.openjdk.java.net/~jzhu/8268858/old_opto_assembly
>   new OptoAssembly: https://cr.openjdk.java.net/~jzhu/8268858/new_opto_assembly
> 
> Could you please help review this patch?
> 
> Best Regards,
> Joshua

Thank you. It is very nice cleanup. I have only few comments.

src/hotspot/cpu/aarch64/aarch64.ad line 2559:

> 2557:   // A call is considered a high register pressure area
> 2558:   // and force spilling around the call.
> 2559:   uint int_pressure_threshold = _NO_SPECIAL_REG32_mask.Size() - 1;

Explain in comment why `-1`.

src/hotspot/cpu/x86/x86_64.ad line 1774:

> 1772: uint Matcher::float_pressure_limit()
> 1773: {
> 1774:   return (FLOATPRESSURE == -1) ? (_FLOAT_REG_mask.Size() - 2) : FLOATPRESSURE;

Explain in comment why -2.

test/hotspot/jtreg/compiler/c2/Test8183543.java line 1:

> 1: /*

Place test into `compiler/regalloc`.
We are avoiding using bug Id in test name now. Use name which explains what test does.

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

PR: https://git.openjdk.java.net/jdk/pull/4505


More information about the hotspot-compiler-dev mailing list