This is the next step for JDK-8242296.
When defining modules via calls to JVM_DefineModule(), we see 596 PackageEntry objects being created, with a runtime overhead of ~250k to create and insert entries, another 300k instructions or so to validate input to Modules::define_modules. There's also the overhead in the Module java object constructor in extracting the package array from the module descriptor (~4% of executed bytecodes on Hello World)
If we could dump or build up package entries from existing information in CDS and coordinate with the API to load in the default module graph from the CDS archive, we might speed up this interaction a lot for the common case where we load the default module graph from CDS.
JVM_DefineModule() is called from the following Java call stack:
http://hg.openjdk.java.net/jdk/jdk/file/15d69d370743/src/java.base/share/classes/java/lang/Module.java#l136
java.lang.Module.defineModule0(Native Method)
java.lang.Module.<init>(Module.java:136)
java.lang.Module.defineModules(Module.java:1128)
java.lang.ModuleLayer.<init>(ModuleLayer.java:178)
java.lang.ModuleLayer.defineModules(ModuleLayer.java:664)
java.lang.ModuleLayer.defineModules(ModuleLayer.java:417)
jdk.internal.module.ModuleBootstrap.boot(ModuleBootstrap.java:408)
java.lang.System.initPhase2(System.java:2070)