This simple changeset enables the diagnostic flag `PrintFlatArrayLayout` in 
product builds, similarly to other diagnostic flags such as `PrintFieldLayout`. 
This was useful to quickly grasp what arrays are flattened when analyzing a 
benchmark.

before:


$ java --enable-preview -XX:+UnlockDiagnosticVMOptions 
-XX:+PrintFlatArrayLayout --version
openjdk 27-jep401ea2 2026-09-15
OpenJDK Runtime Environment (build 27-jep401ea2-rocastan.open)
OpenJDK 64-Bit Server VM (build 27-jep401ea2-rocastan.open, mixed mode)


after:


$ java --enable-preview -XX:+UnlockDiagnosticVMOptions 
-XX:+PrintFlatArrayLayout --version
Flat Type Array: [Ljava.lang.Character; {0x0000000095040348}
 - element klass: 'java/lang/Character'
 - layout kind: NULLABLE_ATOMIC_FLAT
 - array properties: DEFAULT (NULLABLE ATOMIC)
 - element size 4 aligned layout size 4
Flat Type Array: [Ljava.lang.Integer; {0x000000009505d0a0}
 - element klass: 'java/lang/Integer'
 - layout kind: NULLABLE_ATOMIC_FLAT
 - array properties: DEFAULT (NULLABLE ATOMIC)
 - element size 8 aligned layout size 8
openjdk 27-jep401ea2 2026-09-15
OpenJDK Runtime Environment (build 27-jep401ea2-rocastan.open)
OpenJDK 64-Bit Server VM (build 27-jep401ea2-rocastan.open, mixed mode)


**Testing**: tier1-3, manually checked that flattened array info is shown on a 
couple of scenarios.

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

Commit messages:
 - Honor PrintFlatArrayLayout in product builds

Changes: https://git.openjdk.org/valhalla/pull/2090/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2090&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8377799
  Stats: 4 lines in 1 file changed: 0 ins; 4 del; 0 mod
  Patch: https://git.openjdk.org/valhalla/pull/2090.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2090/head:pull/2090

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

Reply via email to