RFR: 8372188: AArch64: Generate atomic match rules from M4 stencils
Aleksey Shipilev
shade at openjdk.org
Thu Nov 27 17:28:18 UTC 2025
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
-------------
Commit messages:
- More Hotspot tests do not like OptoAssembly changes
- Some tests want specific formats + moves
- Minor stencil touchup
- Missed L_Acq variants
- No more atomics in main AD
- Fix
Changes: https://git.openjdk.org/jdk/pull/28538/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28538&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8372188
Stats: 2349 lines in 5 files changed: 1156 ins; 1193 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/28538.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28538/head:pull/28538
PR: https://git.openjdk.org/jdk/pull/28538
More information about the hotspot-compiler-dev
mailing list