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

Ioi Lam iklam at openjdk.org
Tue Feb 18 23:30:04 UTC 2025


On Tue, 11 Feb 2025 00:25:39 GMT, Calvin Cheung <ccheung 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")`.

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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23546#discussion_r1956965075
PR Review Comment: https://git.openjdk.org/jdk/pull/23546#discussion_r1956964843


More information about the hotspot-runtime-dev mailing list