RFR: 8368199: Add @AOTSafeClassInitializer to jdk.internal.access.SharedSecrets

Per Minborg pminborg at openjdk.org
Mon Oct 27 08:52:04 UTC 2025


On Fri, 17 Oct 2025 22:20:12 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> By annotating `SharedSecrets` as `@AOTSafeClassInitializer`, we can avoid using the `@AOTRuntimeSetup` annotations in a few JDK core classes. This simplifies the implementation. It also brings us closer to the goal of making the AOT cache as a true snapshot of the JVM state that just needs to be resumed in the production run.

src/hotspot/share/cds/cdsHeapVerifier.cpp line 186:

> 184:     if (fd->signature()->starts_with("Ljdk/internal/access/") &&
> 185:         fd->signature()->ends_with("Access;")) {
> 186:       // The jdk/internal/access/*Access classes carry no states so they can be safely

This might be true for the time being, but adding such an assumption is a constraint for the future and should be documented. Perhaps we should have an interface `Access` that the various access classes implement, and where we could document this and other constraints of the access classes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27880#discussion_r2464838946


More information about the hotspot-runtime-dev mailing list