RFR: 8372154: AArch64: Match rule failure with some CompareAndSwap operand shapes

Aleksey Shipilev shade at openjdk.org
Wed Nov 19 18:23:52 UTC 2025


See bug for more details. 

Following up on [JDK-8371959](https://bugs.openjdk.org/browse/JDK-8371959) failures, I managed to reproduce the "bad AD" file assert. It is heavily intermittent, and needs hours of runs before we hit the lucky seed, plus [JDK-8360557](https://bugs.openjdk.org/browse/JDK-8360557) to have broader testing scope. 

It looks like `CastII` node accepts the wider operand type (`iRegI`), which fails to match against narrower type in CAS match rules (`iRegINoSp`). It makes sense to use `iRegINoSp` for destination regs, so that we do not start writing to these special registers. But for operand registers, it makes little sense, IMO. I note that cas.m4-generated CAE/WCAS stubs actually already have the wider `iRegI` for operand types. 

So it looks to me the manual CAS match rules should also use `iRegI`. It would be even better to auto-generate these match rules from M4 stencils, and I tried that, but ultimately decided it obscures the actual bug fix. [JDK-8372188](https://bugs.openjdk.org/browse/JDK-8372188) is dedicated to moving the match rules, hopefully without the semantic change.

In this change, I dropped `*NoSp` from CAS operand match rules. It fixes the `iRegI` mismatch, and prepares us for harmonizing these rules with the rest of CAS/CAE generated ones.

Additional testing:
 - [x] Linux AArch64 server fastdebug, local `bad AD` assert reproducer no longer fails
 - [ ] Linux AArch64 server fastdebug, `all`
 - [ ] Linux AArch64 server fastdebug, jcstress run

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/jdk/pull/28398/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28398&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8372154
  Stats: 15 lines in 1 file changed: 0 ins; 0 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/28398.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28398/head:pull/28398

PR: https://git.openjdk.org/jdk/pull/28398


More information about the hotspot-compiler-dev mailing list