Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8365645

AOT Cache Snapshot Model

XMLWordPrintable

      This RFE is an overview of the AOT Cache Snapshot Model, which will be implemented as a series of RFEs linked below. The RFEs can also be search with https://bugs.openjdk.org/issues/?jql=labels%20%3D%20aot-cache-snapshot-model

      BACKGROUND
      ============

      Optimizations from Project Leyden has been integrated into the JDK mainline since JDK 24 and are available to Java developers through the AOT cache (-XX:AOTCache=xxx.aot). The AOT cache contains many artifacts that are created ahead-of-time. During a production run, the application can improve start-up time and memory footprint by using these artifacts (such as class metadata, heap objects, and compiled methods) without creating them from scratch.

      As of JDK 25, the AOT artifacts are configured incrementally during the JVM bootstrap. For example:

      - Classes are individually added to the system dictionary through the SystemDictionay::resolve_or_fail() APIs.

      - AOT-generated method adapter entries are associated with methods during class linking time,

      - AOT-computed module information are programmatically added to the module system

      - AOT-initialized classes are individually switched into the "initialized" state.

      While the above is in progress, some Java bytecodes may be executed and may observe a partial state because not all the AOT artifacts are fully configured.

      GOAL
      ====

      Artifacts in the AOT cache should be loaded as a "snapshot" during bootstrap of the application's production run.

      - While some native code must be executed to load the AOT artifacts (e.g., to perform relocation due to ASLR), we should limit such native code to a minimum, to reduce the chance that some native code may observe a partially configured AOT artifact.

      - All AOT artifacts should be loaded and configured before any Java code is executed. This will make it impossible for Java code to observe a partial state.

      MODEL
      ======

      When an AOT cache is loaded in application's production run and the first Java bytecode is executed, all the states observable by the Java application should be exactly the same as the states that were observable at the end of the AOT assembly phase.

      IMPLEMENTATION
      ===============

      TBD

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: