JDK-8372729 : [lworld] Incorrect result of acmp with flat, nullable value class field
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: repo-valhalla
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-11-28
  • Updated: 2025-12-15
  • Resolved: 2025-12-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-valhallaFixed
Related Reports
Blocks :  
Relates :  
Description
Attached Test.java fails due to an incorrect result of acmp:

java --enable-preview -Xint Test.java
Exception in thread "main" java.lang.RuntimeException: Incorrect result 'true' for NestedValue(null) == NestedValue(IntValue(0, bits=0x0))
	at Test.main(Test.java:59)

It passes without field flattening though:

java --enable-preview -Xint -XX:-UseFieldFlattening Test.java

Also happens with -XX:+UseAltSubstitutabilityMethod.
Comments
A pull request was submitted for review. Branch: lworld URL: https://git.openjdk.org/valhalla/pull/1790 Date: 2025-12-11 19:40:03 +0000
11-12-2025

This is because the null marker field not being captured by LayoutIteration.
04-12-2025

Okay, assuming that JDK-8372954 will remove / disable the current implementation, no need to fix it.
03-12-2025

[~liach] Could you or someone from core-libs fix the legacy method? This blocks JDK-8228361. Thanks!
03-12-2025

I've created JDK-8372955 to track the issue in the alternative substitutability test method. This CR can be used to track the issue in the legacy method.
02-12-2025

[~liach] I think Fred found the issue in the alt implementation. Could you provide a fix for the current implementation?
02-12-2025

I know the main substitutability is not comparing the null byte for flattened layout correctly. However, the null byte should be in the alt substitutability, so the cause might be something else.
01-12-2025