RFR: 8352092: -XX:AOTMode=record crashes with InstanceKlass in allocated state [v2]

Coleen Phillimore coleenp at openjdk.org
Mon Mar 31 20:36:09 UTC 2025


On Thu, 27 Mar 2025 14:32:53 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Please review this small fix for a crash that can be caused only with JNI `DefineClass()` calls, which can leave a class in the `allocated` state inside a `ClassLoaderData` when the class is in a prohibited package such as `java/foo`.
>> 
>> The bug was found when running the JCK with an AOT cache. I tried to write a jtreg regression test but it's not possible to use pure Java code to reproduce this condition -- attempts by Java code to define classes in a prohibited package will be blocked from entering the ClassFileParser.
>
> Ioi Lam has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Move CollectClassesForLinking inside while loop to see classes loaded as side effect of linking
>  - @coleenp comments - use ClassLoaderDataGraph::loaded_classes_do_keepalive()

One small comment, but looks good!

src/hotspot/share/cds/metaspaceShared.cpp line 690:

> 688: 
> 689: public:
> 690:   CollectClassesForLinking() {}

Do you need this empty constructor?  _mirrors is initialized by default initializer to a small array, or should you give this a length?

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/24172#pullrequestreview-2730444367
PR Review Comment: https://git.openjdk.org/jdk/pull/24172#discussion_r2021727431


More information about the hotspot-runtime-dev mailing list