<i18n dev> RFR: 8373392: Replace CDS object subgraphs with @AOTSafeClassInitializer [v2]

Ioi Lam iklam at openjdk.org
Wed Dec 17 18:16:23 UTC 2025


> In legacy CDS, Java objects used by certain classes are computed ahead of time using "object subgraphs"
> 
> https://github.com/openjdk/jdk/blob/1bbbce75c5e68429c2a32519eb3c36d964dcdf57/src/hotspot/share/cds/heapShared.cpp#L168-L171
> 
> Examples of subgraphs:
> 
> - `java.lang.Integer$IntegerCache::cache`
> - `jdk.internal.module.ArchivedBootLayer::bootLayer`
> 
> The implementation requires special code (in both Java and C++) to be executed when a CDS archive is created or loaded. As a result, we have an execution model that's difficult to implement/extend and the behavior is hard to understand.
> 
> To move towards the AOT Cache Snapshot Model ([JDK-8365645](https://bugs.openjdk.org/browse/JDK-8365645)) we should replace the subgraphs with the use of `@AOTSafeClassInitializer`, and if necessary, `@AOTRuntimeSetup`. This will simplify the current implementation, and make it possible to extend AOT-initializations to more core classes.
> 
> Note, the use of `@AOTSafeClassInitializer` requires `-XX:+AOTClassLinking`. For the time being, we retain the old CDS object subgraph code to cover the `-XX:-AOTClassLinking` cases. Such code will be marked with comments like `/* Legacy CDS archive support (to be deprecated) */`. All future AOT creation of Java objects will be done with  `@AOTSafeClassInitializer`.

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 three additional commits since the last revision:

 - @liach comment: Fixed identation
 - Merge branch 'master' into 8373392-replace-cds-object-subgraphs-with-aot-safe-class-initializer
 - 8373392: Replace CDS object subgraphs with @AOTSafeClassInitializer

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28736/files
  - new: https://git.openjdk.org/jdk/pull/28736/files/562d15a9..5497502f

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28736&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28736&range=00-01

  Stats: 15093 lines in 587 files changed: 9847 ins; 1687 del; 3559 mod
  Patch: https://git.openjdk.org/jdk/pull/28736.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28736/head:pull/28736

PR: https://git.openjdk.org/jdk/pull/28736


More information about the i18n-dev mailing list