RFR: 8375654: Exclude all array classes from dynamic CDS archive
Vladimir Kozlov
kvn at openjdk.org
Thu Jan 22 17:22:05 UTC 2026
On Thu, 22 Jan 2026 02:49:17 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> In `A` is a subtype of `B`, it's possible for an `ObjArrayKlass` for `A[]` to be archived in the dynamic CDS archive and its `_secondary_supers` contains a pointer to an `ObjArrayKlass` for `B[]` that's also archived in the dynamic archive.
>
> This scenario used to be supported, but since [JDK-8374639](https://bugs.openjdk.org/browse/JDK-8374639), if `B` is archived in the static CDS archive, at runtime a different `B[]` is created dynamically. As a result, we can no longer typecast an instance of `A[]` into an instance of `B[]`.
>
> Since `ObjArrayKlasses` are cheap to allocate at runtime, the easiest fix is to simply not store any `ObjArrayKlass` in the dynamic CDS archive.
>
> (I also added missing copyright header to a problem list file used by CDS/AOT testing).
Will this affect Leyden? In AOT code generation we store number of dimensions and Klass: https://github.com/openjdk/leyden/blob/premain/src/hotspot/share/code/aotCodeCache.cpp#L2399-L2402
When we load AOT code we assume that such array already exist - we use `k->array_klass_or_null(array_dim)`:
https://github.com/openjdk/leyden/blob/premain/src/hotspot/share/code/aotCodeCache.cpp#L2475-L2480
There is comment there to create the array instead of just lookup. Should,d we use commented code after these changes?
-------------
PR Review: https://git.openjdk.org/jdk/pull/29356#pullrequestreview-3693629826
More information about the hotspot-runtime-dev
mailing list