Add @AOTInitialize annotation

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P4
    • 26
    • Affects Version/s: None
    • Component/s: hotspot

      A class such as jdk.internal.math.MathUtils initialize large arrays in their <clinit>. It's beneficial to AOT-initialize them to improve start-up time:

      @jdk.internal.vm.annotation.AOTInitialize
      final class MathUtils {
          private static final long[] g = { ... over 1200 items ...}

      Note that we already have a @AOTSafeClassInitializer that works slightly differently:

         @AOTInitialize class A {...}
         @AOTSafeClassInitializer class B {...}
       
      Similarity: the annotation takes effect only if the annotated class is included in an AOT cache. (e.g., the class was used in a training run).

      Difference: the JVM will force A to be initialized in the AOT assembly run. A will always be cached in the aot-initialized state.

      The JVM does not force B to be initialized in the AOT assembly run. B will be cached in the aot-initialized state only if it was initialized during the AOT assembly run as a side effect of Java code execution (e.g., in module bootstrap or when linking invokedynamic bytecodes).

            Assignee:
            Ioi Lam
            Reporter:
            Ioi Lam
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: