RFR: 8316969: Improve CDS module graph support for --module option

Calvin Cheung ccheung at openjdk.org
Tue Oct 17 22:51:49 UTC 2023


On Tue, 3 Oct 2023 07:11:54 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Please review this changeset for adding support for `--module` (-m) option for CDS.
>> Changes in the `ModuleBootstrap.java` are needed so that the `ArchivedModuleGraph.archive` and `ArchivedBootLayer.archive` are called if the main module is specified. The module name will be stored in the ro region of the CDS archive. During runtime, the archived module name will be compared with the runtime module name. If comparison fails, the archived full module graph won't be used.
>> 
>> Note: this RFE is a subtask of [JDK-8266329](https://bugs.openjdk.org/browse/JDK-8266329). More subtask(s) will be created to support other options such as `--add-modules`.
>> 
>> Passed tiers 1 - 4 testing.
>
> src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java line 239:
> 
>> 237:                        // only consider modules from JDK
>> 238:                        (mainModule.startsWith("jdk.") || mainModule.startsWith("java."))) {
>> 239:                     canArchive = true;
> 
> This will require discussion as there may be modules in the run-time image that start with other names.

It would be nice if there's another way to find out if a module is from JDK.

> src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java line 483:
> 
>> 481:         // Archive module graph and boot layer can be archived at CDS dump time.
>> 482:         // Only allow the unnamed module case for now.
>> 483:         if (canArchive) {
> 
> Doesn't this invalidate the comments?

I'll update the comment in my next update.
I've just pushed a commit based on some offline discussion with Ioi.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16016#discussion_r1346118458
PR Review Comment: https://git.openjdk.org/jdk/pull/16016#discussion_r1346119507


More information about the core-libs-dev mailing list