[lworld] RFR: 8375548: [lworld] C2: Support value class arrays with compiler replay [v2]

Christian Hagedorn chagedorn at openjdk.org
Thu Jan 22 14:42:44 UTC 2026


> When using compiler replay with `--enable-preview` with array store/load profiling, we only create `ObjArrayKlass` objects instead of subclass objects (i.e. `RefArrayKlass` or `FlatArrayKlass`). The reason is that we are directly resolving klasses with `SystemDirectory::resolve_or_fail()`:
> https://github.com/openjdk/valhalla/blob/a4fb7ebd5af316d3e99d10bffb44d5be3aab5548/src/hotspot/share/ci/ciReplay.cpp#L557
> 
> This method will call `InstanceKlass::array_klass()` at some point which directly creates an `ObjArrayKlass` object. This let's the replayed compilation fail when trying to speculate on an value class array which expects a subclass of `ObjArrayKlass`.
> 
> The fix I propose is to make sure that we are always creating subclass objects by explicitly using `ArrayProperties::DEFAULT` when parsing an `ArrayKlass` during replay compilation.
> 
> I added a compiler replay test which triggers the same assert as shown in the report.
> 
> Thanks,
> Christian

Christian Hagedorn has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - support value class arrays
 - Merge branch 'lworld' into JDK-8375548
 - Revert "8375548: [lworld] C2: Compiler replay fails with an assertion due to not loading object array klasses with ArrayProperties::DEFAULT"
   
   This reverts commit 0cdb2549427a02c6d77adbbf29ba5ed1d1d38293.
 - 8375548: [lworld] C2: Compiler replay fails with an assertion due to not loading object array klasses with ArrayProperties::DEFAULT

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/1931/files
  - new: https://git.openjdk.org/valhalla/pull/1931/files/0cdb2549..a7c28865

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=valhalla&pr=1931&range=01
 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1931&range=00-01

  Stats: 1216 lines in 39 files changed: 678 ins; 186 del; 352 mod
  Patch: https://git.openjdk.org/valhalla/pull/1931.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1931/head:pull/1931

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


More information about the valhalla-dev mailing list