RFR: 8372188: AArch64: Generate atomic match rules from M4 stencils
Aleksey Shipilev
shade at openjdk.org
Thu Nov 27 17:28:18 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
Sanity checking with:
$ git diff master | grep ^- | grep instruct | grep "%{" | grep -v \$ | sort | nl
...
$ git diff master | grep ^+ | grep instruct | grep "%{" | grep -v \$ | sort | nl
...
60 match rules out, 60 match rules in.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28538#issuecomment-3586352646
More information about the hotspot-compiler-dev
mailing list