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).

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

Commit messages:
 - Fix pointer tests.

Changes: https://git.openjdk.org/valhalla/pull/2329/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2329&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8382027
  Stats: 9 lines in 2 files changed: 3 ins; 0 del; 6 mod
  Patch: https://git.openjdk.org/valhalla/pull/2329.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2329/head:pull/2329

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

Reply via email to