On Sat, 21 Jun 2025 00:03:26 GMT, Chen Liang <li...@openjdk.org> wrote:

> Currently, the list of classes that have <clinit> interdependencies and those 
> that need runtimeSetup are maintained in a hardcoded list in CDS. This makes 
> it risky for core library developers as they might introduce new 
> interdependencies and observe CDS to fail. By moving the mechanism of these 
> lists to core library annotations as a first step, we can gradually expose 
> the AOT contracts as program semantics described by internal annotations, and 
> also helps us to explore how we can expose these functionalities to the 
> public later.

Please update the comment in `aotArtifactFinder.hpp` to mention the annotation; 
it currently mentions the C++ accessor but should also mention the annotation 
that drives it.

A class is AOT-init if EITHER it has the `@AOTClInit` annotation OR it is in 
the heap for other reasons.  So it’s harmless to put `@AOTClInit` on those 
extra classes that need `runtimeSetup` calls.

If you agree with that logic, then I recommend not having a separate `@RTS` 
anno as well.  I don’t think that second anno pulls its weight.  Just execute 
the `runtimeSetup` method in any annotated class, as part of the contract of 
that annotation.

In the future we may also want an `assemblyCleanup` hook in the same potential 
places.

src/java.base/share/classes/java/lang/invoke/VarHandles.java line 751:

> 749: //            System.out.println("import 
> jdk.internal.vm.annotation.ForceInline;");
> 750: //            System.out.println("import 
> jdk.internal.vm.annotation.Hidden;");
> 751: //            System.out.println("import 
> jdk.internal.vm.annotation.MethodHandleArchived;");

this name needs to be adjusted in the comments

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

Changes requested by jrose (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25922#pullrequestreview-2955770916
PR Review Comment: https://git.openjdk.org/jdk/pull/25922#discussion_r2165174485

Reply via email to