< prev index next >
src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java
Print this page
*** 170,179 ****
--- 170,180 ----
SystemModules systemModules = null;
ModuleFinder systemModuleFinder;
boolean haveModulePath = (appModulePath != null || upgradeModulePath != null);
boolean needResolution = true;
+ boolean canArchive = false;
// If the java heap was archived at CDS dump time and the environment
// at dump time matches the current environment then use the archived
// system modules and finder.
ArchivedModuleGraph archivedModuleGraph = ArchivedModuleGraph.get(mainModule);
*** 184,194 ****
&& !isPatched) {
systemModules = archivedModuleGraph.systemModules();
systemModuleFinder = archivedModuleGraph.finder();
needResolution = (traceOutput != null);
} else {
- boolean canArchive = false;
if (!haveModulePath && addModules.isEmpty() && limitModules.isEmpty()) {
systemModules = SystemModuleFinders.systemModules(mainModule);
if (systemModules != null && !isPatched) {
needResolution = (traceOutput != null);
canArchive = true;
--- 185,194 ----
*** 204,219 ****
} else {
// exploded build or testing
systemModules = new ExplodedSystemModules();
systemModuleFinder = SystemModuleFinders.ofSystem();
}
-
- // Module graph can be archived at CDS dump time. Only allow the
- // unnamed module case for now.
- if (canArchive && (mainModule == null)) {
- ArchivedModuleGraph.archive(mainModule, systemModules, systemModuleFinder);
- }
}
Counters.add("jdk.module.boot.1.systemModulesTime", t1);
--- 204,213 ----
*** 351,363 ****
--- 345,361 ----
Configuration cf;
if (needResolution) {
cf = JLMA.resolveAndBind(finder, roots, traceOutput);
} else {
+ if (archivedModuleGraph != null) {
+ cf = archivedModuleGraph.configuration();
+ } else {
Map<String, Set<String>> map = systemModules.moduleReads();
cf = JLMA.newConfiguration(systemModuleFinder, map);
}
+ }
// check that modules specified to --patch-module are resolved
if (isPatched) {
patcher.patchedModules()
.stream()
*** 434,443 ****
--- 432,448 ----
unlimitedFinder = new SafeModuleFinder(savedModuleFinder);
if (savedModuleFinder != finder)
limitedFinder = new SafeModuleFinder(finder);
}
+ // Module graph can be archived at CDS dump time. Only allow the
+ // unnamed module case for now.
+ if (canArchive && (mainModule == null)) {
+ ArchivedModuleGraph.archive(mainModule, systemModules,
+ systemModuleFinder, cf);
+ }
+
// total time to initialize
Counters.add("jdk.module.boot.totalTime", t0);
Counters.publish();
return bootLayer;
< prev index next >