[lworld] RFR: 8356599: [lworld] C2 incorrectly folds array object klass load for atomic arrays

Tobias Hartmann thartmann at openjdk.org
Fri May 9 06:43:41 UTC 2025


`TypeAryKlassPtr` and `TypeAryPtr`/`TypeAry` in C2's typesystem currently don't keep track of atomicity of arrays. As a result, C2 might incorrectly fold loads from `GraphKit::load_object_klass` to non-atomic `TypeAryKlassPtr`, resulting in the `GraphKit::null_free_atomic_array_test` to incorrectly return false at runtime.

I fixed this by selectively disabling folding of the klass load done by the `GraphKit::null_free_atomic_array_test` via a `fold_for_arrays` flag for now. I'll revisit this with JDK-8350865.

Thanks,
Tobias

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

Commit messages:
 - Updated comment
 - 8356599: [lworld] C2 incorrectly folds array object klass load for atomic arrays

Changes: https://git.openjdk.org/valhalla/pull/1451/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1451&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8356599
  Stats: 170 lines in 13 files changed: 117 ins; 17 del; 36 mod
  Patch: https://git.openjdk.org/valhalla/pull/1451.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1451/head:pull/1451

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


More information about the valhalla-dev mailing list