On Mon, 19 Jan 2026 14:51:48 GMT, Christian Hagedorn <[email protected]> 
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

src/hotspot/share/ci/ciReplay.cpp line 562:

> 560:         // Create ref or flat array klass.
> 561:         k = 
> ObjArrayKlass::cast(k)->klass_with_properties(ArrayKlass::ArrayProperties::DEFAULT,
>  THREAD);
> 562:       }

This will always create the default refined klass. Shouldn't we keep track of 
which refined klass was actually referenced in the replay file and then create 
that particular one here?

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1931#discussion_r2705210950

Reply via email to