RFR: 8372188: AArch64: Generate atomic match rules from M4 stencils

Aleksey Shipilev shade at openjdk.org
Fri Nov 28 10:53:55 UTC 2025


On Thu, 27 Nov 2025 14:54:06 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Current atomic match rules are all over the place in AArch64:
>  - CAE and weak CAS rules are generated with the help of `cas.m4`, and then are supposed to be copy-pasted (?) into `aarch64.ad`. I did it about 20 times when fixing [JDK-8372154](https://bugs.openjdk.org/browse/JDK-8372154), gets tedious very quickly.
>  - Strong CAS and get-and-set rules are still in the same section of `aarch64.ad`, and are written by hand. Yet, those can be automatically generated from M4 stencils as well.
> 
> This PR cleans that up by moving all these rules into a separate `.ad` file, which one can cleanly re-generate by invoking `m4 aarch64_atomic_ad.m4 > aarch64_atomic.ad`. The meat of the change is `aarch64_atomic.m4`, everything else is either generated from it, or removed in favor of auto-generated code. There should be no semantic change, as I attempted to move the rules mostly verbatim, only changing non-semantic stuff like match rule names and some formats.
> 
> Testing:
>  - [x] Eyeballing match rules before/after
>  - [x] Linux AArch64 server fastdebug, `hotspot_compiler`
>  - [x] Linux AArch64 server fastdebug, `tier1`
>  - [x] Linux AArch64 server fastdebug, `all`
>  - [x] Linux AArch64 server fastdebug, jcstress run

Thanks for reviews! All tests are passing (there are some known AArch64 failures). But it is a large patch, so I will integrate this on Monday to avoid dealing with any breakages over the weekend.

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

PR Comment: https://git.openjdk.org/jdk/pull/28538#issuecomment-3588824144


More information about the hotspot-compiler-dev mailing list