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

Aleksey Shipilev shade at openjdk.org
Fri Nov 21 09:42:35 UTC 2025


On Thu, 20 Nov 2025 07:55:51 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> 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
>>  - [x] Linux AArch64 server fastdebug, `all`
>>  - [x] Linux AArch64 server fastdebug, jcstress run
>
> Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'master' into JDK-8372154-aarch64-cas-operand-match
>  - Fix

There we go. Nothing bad is going to happen if I push on Friday, I am sure.

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

PR Comment: https://git.openjdk.org/jdk/pull/28398#issuecomment-3562192388


More information about the hotspot-compiler-dev mailing list