< prev index next >

src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java

Print this page
rev 57943 : 8237878: Improve ModuleLoaderMap datastructures
Reviewed-by: alanb

@@ -381,11 +381,16 @@
         // loader.
 
         long t5 = System.nanoTime();
 
         // mapping of modules to class loaders
-        Function<String, ClassLoader> clf = ModuleLoaderMap.mappingFunction(cf);
+        ModuleLoaderMap.Mapper clf;
+        if (archivedModuleGraph != null) {
+            clf = archivedModuleGraph.classLoaderFunction();
+        } else {
+            clf = ModuleLoaderMap.mappingFunction(cf);
+        }
 
         // check that all modules to be mapped to the boot loader will be
         // loaded from the runtime image
         if (haveModulePath) {
             for (ResolvedModule resolvedModule : cf.modules()) {

@@ -456,17 +461,18 @@
         }
 
         // Module graph can be archived at CDS dump time. Only allow the
         // unnamed module case for now.
         if (canArchive && (mainModule == null)) {
-            ArchivedModuleGraph.archive(mainModule,
-                                        hasSplitPackages,
+            ArchivedModuleGraph.archive(
+                    new ArchivedModuleGraph(hasSplitPackages,
                                         hasIncubatorModules,
                                         systemModuleFinder,
                                         cf,
+                                            clf,
                                         concealedPackagesToOpen,
-                                        exportedPackagesToOpen);
+                                            exportedPackagesToOpen));
         }
 
         // total time to initialize
         Counters.add("jdk.module.boot.totalTime", t0);
         Counters.publish();

@@ -754,11 +760,10 @@
                         Modules.addOpens(m, pn, other);
                     } else {
                         Modules.addExports(m, pn, other);
                     }
                 }
-
             }
         }
     }
 
     /**
< prev index next >