RFR: 8348322: AOT cache creation crashes with "All cached hidden classes must be aot-linkable" when AOTInvokeDynamicLinking is disabled

Calvin Cheung ccheung at openjdk.org
Tue Feb 18 23:30:04 UTC 2025


On Sat, 15 Feb 2025 01:09:08 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> This changeset fixes a crash during AOT cache creation when `AOTInvokeDynamicLinking` is disabled.
>> Changes in `cdsHeapVerifier.cpp` is required to avoid error such as the following during AOT cache creation:
>> 
>> 
>> [4.156s][warning][cds,heap] Archive heap points to a static field that may hold a different value at runtime:
>> [4.156s][warning][cds,heap] Field: java/util/Collections::EMPTY_LIST
>> 
>> Per Ioi's suggestions, added the `CDSConfig::is_dumping_method_handles()` so that most of the calls to `CDSConfig::is_dumping_aot_linked_classes()` and `CDSConfig::is_dumping_invokedynamic()` could be replaced with the new function.
>> 
>> Passed tiers 1 - 3 testing.
>
> src/hotspot/share/cds/aotArtifactFinder.cpp line 213:
> 
>> 211:     if (ik->is_hidden() && CDSConfig::is_initing_classes_at_dump_time()) {
>> 212:       bool succeed = AOTClassLinker::try_add_candidate(ik);
>> 213:       if (CDSConfig::is_dumping_method_handles()) {
> 
> This should be `assert(CDSConfig::is_dumping_method_handles(), "sanity")`.

Fixed.

> src/hotspot/share/cds/aotClassLinker.cpp line 146:
> 
>> 144:     assert(ik->shared_class_loader_type() != ClassLoader::OTHER, "must have been set");
>> 145:     if (!CDSConfig::is_dumping_invokedynamic()) {
>> 146:       return true;
> 
> I think this should be 
> 
> if (!CDSConfig::is_dumping_methodhandles()) {
>   return false;
> }
> 
> 
> Because `is_dumping_methodhandles()` can generate hidden classes that are not lambda proxies.

Fixed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23546#discussion_r1960730315
PR Review Comment: https://git.openjdk.org/jdk/pull/23546#discussion_r1960730231


More information about the hotspot-runtime-dev mailing list