RFR: 8368174: Proactive initialization of @AOTSafeClassInitializer classes [v2]
Ioi Lam
iklam at openjdk.org
Tue Sep 23 22:10:57 UTC 2025
On Mon, 22 Sep 2025 09:18:22 GMT, Andrew Dinn <adinn at openjdk.org> wrote:
>> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
>>
>> - Exclude new test from hotspot_aot_classlinking and hotspot_appcds_dynamic test groups
>> - @adinn and @liach comments
>> - Merge branch 'master' into 8368174-proactive-init-aot-safe-class-initializer
>> - updated javadoc for AOTSafeClassInitializer.java
>> - Fix
>> - imported
>
> src/hotspot/share/cds/aotClassInitializer.cpp line 294:
>
>> 292: });
>> 293: } else {
>> 294: // @AOTRuntimeSetup only meaningful in @AOTClassInitializer
>
> Suggestion:
>
> // @AOTRuntimeSetup only meaningful in @AOTSafeClassInitializer
Fixed.
> src/hotspot/share/cds/aotMetaspace.cpp line 815:
>
>> 813: FinalImageRecipes::apply_recipes(CHECK);
>> 814:
>> 815: // Because the AOT assembly phase does not run the exact code as in the
>
> Suggestion:
>
> // Because the AOT assembly phase does not run the exact same code as in the
Fixed.
> src/java.base/share/classes/jdk/internal/vm/annotation/AOTSafeClassInitializer.java line 45:
>
>> 43: /// _X_ can still be triggered by normal execution of Java code in the assembly phase.
>> 44: /// This is usually the result of performing AOT optimizations for the
>> 45: /// `java.lang.invoke` package.
>
> Suggestion:
>
> /// At present this is usually the result of performing AOT optimizations for
> /// the `java.lang.invoke` package but the set of classes which may be
> /// pre-initialized via this annotation is not restricted to just that case.
Under this this bullet point we are talking about classes that are initialized by other reasons, and not "via this annotation".
I changed the comment to the following to make it clear that the "At present ..." part is about the second scenario:
/// 1. If _X_ was initialized during the AOT training run, the JVM will proactively
/// initialize _X_ in the assembly phase.
/// 2. If _X_ was not initialized during the AOT training run, the initialization of
/// _X_ can still be triggered by normal execution of Java code in the assembly
/// phase. At present this is usually the result of performing AOT optimizations for
/// the `java.lang.invoke` package but it may include other cases as well.
What do you think?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27402#discussion_r2373558649
PR Review Comment: https://git.openjdk.org/jdk/pull/27402#discussion_r2373558523
PR Review Comment: https://git.openjdk.org/jdk/pull/27402#discussion_r2373558380
More information about the core-libs-dev
mailing list