JDK-8365978 : [lworld] C2: assert(vk->maybe_flat_in_array()) when using compareAndSetFlatValue with -XX:-UseArrayFlattening
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2025-08-22
  • Updated: 2025-09-05
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-valhallaUnresolved
Related Reports
Blocks :  
Description
Attached reproducer, to run with

javac --enable-preview --source 25 --add-exports java.base/jdk.internal.misc=ALL-UNNAMED PutFlatValueCrash.java

java -ea --enable-preview --add-exports java.base/jdk.internal.misc=ALL-UNNAMED -XX:-UseArrayFlattening -Xcomp -XX:CompileCommand=compileonly,"PutFlatValueCrash::test" -XX:-TieredCompilation PutFlatValueCrash


This is because compareAndSetFlatValue uses compareAndSetFlatValueAsBytes which uses putFlatValue on a flat array (provided by newSpecialArray), which is intrinsified and crashes when UseArrayFlattening is disabled.

Note that newSpecialArray would raise if called with -XX:-UseArrayFlattening, this is fine. But putFlatValue shouldn't crash (or be rejected) compile time because it might just be not executed at runtime.


Comments
A pull request was submitted for review. Branch: lworld URL: https://git.openjdk.org/valhalla/pull/1549 Date: 2025-09-05 11:42:42 +0000
05-09-2025