RFR: 8316969: Improve CDS module graph support for --module option [v3]

Calvin Cheung ccheung at openjdk.org
Fri Oct 27 19:06:34 UTC 2023


On Fri, 27 Oct 2023 17:40:12 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> I reran the script you sent me few days ago and got the expected results with the latest changes.
>> The checking of the main module name matches between dump time and runtime is performed in the VM code. If an archive (even the default CDS archive classes.jsa) is created with the -m option, running with just `java -version` will disable the optimized module handling.
>> 
>> [0.136s][info ][cds        ] _archived_main_module_name m
>> [0.136s][info ][cds        ] Module m specified during dump time but not during runtime
>> [0.136s][info ][cds        ] Disabling optimized module handling
>> [0.136s][info ][cds        ] optimized module handling: disabled
>> [0.136s][info ][cds        ] full module graph: disabled
>
>> I reran the script you sent me few days ago and got the expected results with the latest changes. The checking of the main module name matches between dump time and runtime is performed in the VM code. If an archive (even the default CDS archive classes.jsa) is created with the -m option, running with just `java -version` will disable the optimized module handling.
>> 
>> ```
>> [0.136s][info ][cds        ] _archived_main_module_name m
>> [0.136s][info ][cds        ] Module m specified during dump time but not during runtime
>> [0.136s][info ][cds        ] Disabling optimized module handling
>> [0.136s][info ][cds        ] optimized module handling: disabled
>> [0.136s][info ][cds        ] full module graph: disabled
>> ```
> 
> Can you check that ArchivedModuleGraph.archivedModuleGraph is null when disabled? When I tried it, it wasn't null so ModuleBootstrap has a module graph containing the modules for m.

The `ArchivedModuleGraph.java` wasn't changed. So if `-m` is not specified, the `archivedModuleGraph` is non-null; if `-m` is specified, the `archivedModuleGraph` is null.
So running `java -version`, the archivedModuleGraph is non-null, but the module m won't be loaded from the archive. I'm seeing the following log output:

`[0.220s][debug][module     ] define_module(): creation of module: m, version: null, location: jrt:/m, loader data: 0x00007f201819dd60 for instance a 'jdk/internal/loader/ClassLoaders$AppClassLoader'{0x000000011f010500}, package #: 1`

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

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


More information about the core-libs-dev mailing list