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

Matias Saavedra Silva matsaave at openjdk.org
Fri Feb 28 18:49:00 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.

Looks good overall but I had some comments. Are there any remaining uses of `is_dumping_invokedynamic()`? I see several cases were replaced and I'm wondering if it's even being used anymore.

src/hotspot/share/cds/cdsConfig.cpp line 618:

> 616: // Archived MethodHandles are required for higher-level optimizations such as AOT resolution of invokedynamic
> 617: // and dynamic proxies.
> 618: bool CDSConfig::is_dumping_method_handles() {

This looks like it does the same check as `is_initing_classes_at_dump_time() ` and is very similar to `is_dumping_invokedynamic()`. Maybe you can combine these methods to avoid duplicate code?

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

PR Review: https://git.openjdk.org/jdk/pull/23546#pullrequestreview-2651539318
PR Review Comment: https://git.openjdk.org/jdk/pull/23546#discussion_r1975869869


More information about the hotspot-runtime-dev mailing list