[lworld] RFR: 8375548: [lworld] C2: Compiler replay does not work due to not creating ObjArrayKlass objects with ArrayProperties::DEFAULT
Christian Hagedorn
chagedorn at openjdk.org
Mon Jan 19 14:58:48 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
-------------
Commit messages:
- 8375548: [lworld] C2: Compiler replay fails with an assertion due to not loading object array klasses with ArrayProperties::DEFAULT
Changes: https://git.openjdk.org/valhalla/pull/1931/files
Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1931&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8375548
Stats: 88 lines in 2 files changed: 88 ins; 0 del; 0 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