[lworld] RFR: 8375548: [lworld] C2: Support value class arrays with compiler replay [v2]
Christian Hagedorn
chagedorn at openjdk.org
Thu Jan 22 14:42:49 UTC 2026
On Thu, 22 Jan 2026 14:37:08 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
>> 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
test/hotspot/jtreg/compiler/ciReplay/TestUnresolvedClasses.java line 2:
> 1: /*
> 2: * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
I've shared some code with this class which already did some of the things required for the new tests.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1931#discussion_r2717178378
More information about the valhalla-dev
mailing list