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

Hao Sun haosun at openjdk.org
Fri Nov 28 02:41:54 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`
>  - [ ] Linux AArch64 server fastdebug, `all`
>  - [ ] Linux AArch64 server fastdebug, jcstress run

LGTM. Thanks for your work.

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

Marked as reviewed by haosun (Committer).

PR Review: https://git.openjdk.org/jdk/pull/28538#pullrequestreview-3517305576


More information about the hotspot-compiler-dev mailing list