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

Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module



    • b02



        The module system bootstrap process creates a set of ModuleReference objects and ModuleDescriptor objects that constitute the observable system modules for the current execution environment based on the precomputed module information at jlink time. The time for creating the ModuleReference objects and ModuleDescriptor objects is a small but measurable portion of the JVM startup time. The goal of this enhancement is to archive the system ModuleReferences and ModuleDescriptors in 'open' archive heap region at CDS dump time, which allows reusing of the objects at runtime and completely bypass the process for creating the observable system ModuleDescriptors and ModuleReferences for startup improvement.

        Support archiving system module graph when the initial module is null (from -cp) currently.

        Support G1 GC, 64-bit (non-Windows). Requires UseCompressedOops and UseCompressedClassPointers.

        Dump time system module object archiving
        At dump time, the following fields in ArchivedModuleGraph are set to record the system module information for archiving.

         private static SystemModules archivedSystemModules;
         private static ModuleFinder archivedSystemModuleFinder;
         private static String archivedMainModule;

        The archiving process starts from a given static field in ArchivedModuleGraph class instance (java mirror object). The process archives the complete network of java heap objects that are reachable directly or indirectly from the starting object by following references.

        1. Starts from a given static field within the Class instance (java mirror). If the static field is a refererence field and points to a non-null java object, proceed to the next step. The static field and it's value is recorded and stored outside the archived mirror.
        2. Archives the referenced java object. If an archived copy of the current object already exists, updates the pointer in the archived copy of the referencing object to point to the current archived object. Otherwise, proceed to the next step.
        3. Follows all references within the current java object and recursively archive the sub-graph of objects starting from each reference encountered within the object.
        4. Updates the pointer in the archived copy of referecing object to point to the current archived object.
        5. The Klass of the current java object is added to a list of Klasses for loading and initializing before any object in the archived graph can be accessed at runtime.

        Runtime initialization from archived system module objects
        VM.initializeFromArchive(<class>) is called from ArchivedModuleGraph's static initializer to initialize from the archived module information. Klasses in the recorded list are loaded, linked and initialized. The static fields in ArchivedModuleGraph class instance are initialized using the archived field values. After initialization, the archived system module objects can be used directly.

        If the archived java heap data is not successfully mapped at runtime, or there is an error during VM.initializeFromArchive(), then all static fields in ArchivedModuleGraph are not initialized. System ModuleDescriptor and ModuleReference objects are created as normal.


          Issue Links



                jiangli Jiangli Zhou
                jiangli Jiangli Zhou
                0 Vote for this issue
                3 Start watching this issue