On Fri, 17 Apr 2026 09:35:56 GMT, Paul Hübner <[email protected]> wrote:

> Hi all,
> 
> This fixes implementation bugs in the interpreter and C1 for `if_acmp<cc>` 
> bytecodes.
> 
> The substitutability check that we perform to determine equality of value 
> objects requires that certain conditions have been checked beforehand. 
> Namely, that it's not the same object, neither is null, and both are value 
> objects with the same klass.
> 
> At the point of the null-check, it is already clear that the oops are 
> unequal; hence the nullcheck checks `lhs == 0 xor rhs == 0`. Both the AArch64 
> interpreter and x86 C1 code falsely ANDs the two operands. This can yield 
> false positives if two oops have no set-bit positions in common (e.g., `1010` 
> and `0101`). The operands need to be compared separately; the interpreter for 
> x86 and C1 for AArch64 already does this.
> 
> Note that this fix is covered by the many test cases failing in 
> `compiler/valhalla/inlinetypes/`.
> 
> Testing: tiers 1-4 on Linux (x64, AArch64), macOS (x64, AArch64), Windows 
> (x64).
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: 3b345f33
Author:    Paul Hübner <[email protected]>
URL:       
https://git.openjdk.org/valhalla/commit/3b345f33d2e898532cbc129a55df04adba13ed92
Stats:     9 lines in 2 files changed: 3 ins; 0 del; 6 mod

8382027: [lworld] if_acmp nullchecks can produce false positives

Co-authored-by: Axel Boldt-Christmas <[email protected]>
Co-authored-by: Joel Sikström <[email protected]>
Co-authored-by: Stefan Karlsson <[email protected]>
Reviewed-by: aboldtch, stefank, thartmann, fparain

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

PR: https://git.openjdk.org/valhalla/pull/2329

Reply via email to