< prev index next >

src/java.base/share/classes/jdk/internal/loader/BootLoader.java

Print this page

@@ -41,10 +41,11 @@
 import java.util.jar.Manifest;
 import java.util.stream.Stream;
 
 import jdk.internal.access.JavaLangAccess;
 import jdk.internal.access.SharedSecrets;
+import jdk.internal.misc.VM;
 import jdk.internal.module.Modules;
 import jdk.internal.module.ServicesCatalog;
 import jdk.internal.util.StaticProperty;
 
 /**

@@ -63,11 +64,26 @@
         UNNAMED_MODULE = SharedSecrets.getJavaLangAccess().defineUnnamedModule(null);
         setBootLoaderUnnamedModule0(UNNAMED_MODULE);
     }
 
     // ServiceCatalog for the boot class loader
-    private static final ServicesCatalog SERVICES_CATALOG = ServicesCatalog.create();
+    private static final ServicesCatalog SERVICES_CATALOG;
+    static {
+        if (ArchivedData.servicesCatalog != null) {
+            SERVICES_CATALOG = ArchivedData.servicesCatalog;
+        } else {
+            SERVICES_CATALOG = ServicesCatalog.create();
+            ArchivedData.servicesCatalog = SERVICES_CATALOG;
+        }
+    }
+
+    static class ArchivedData {
+        static ServicesCatalog servicesCatalog;
+        static {
+            VM.initializeFromArchive(ArchivedData.class);
+        }
+    }
 
     // ClassLoaderValue map for the boot class loader
     private static final ConcurrentHashMap<?, ?> CLASS_LOADER_VALUE_MAP
         = new ConcurrentHashMap<>();
 
< prev index next >