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

2023-11-02 Thread Calvin Cheung
On Wed, 1 Nov 2023 11:26:48 GMT, Alan Bateman wrote: >> Calvin Cheung has updated the pull request incrementally with one additional >> commit since the last revision: >> >> more comments from Alan and Ioi; copyright year update > > Marked as reviewed by alanb (Reviewer). Thanks @AlanBateman

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

2023-11-01 Thread Ioi Lam
On Thu, 2 Nov 2023 02:48:34 GMT, Calvin Cheung 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

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

2023-11-01 Thread Calvin Cheung
> 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 t

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

2023-11-01 Thread Alan Bateman
On Tue, 31 Oct 2023 20:45:11 GMT, Calvin Cheung wrote: > Do you prefer the `canArchive` setting be inside `if > (CDS.isDumpingStaticArchive())` like the following? > > ``` > if (CDS.isDumpingStaticArchive()) > canArchive = true; > ``` That's fine. It has been harmless to have canAr

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

2023-11-01 Thread Alan Bateman
On Wed, 1 Nov 2023 04:34:35 GMT, Calvin Cheung 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

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

2023-10-31 Thread Calvin Cheung
On Fri, 27 Oct 2023 16:34:20 GMT, Ioi Lam wrote: >> Calvin Cheung has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains ten commits: >> >> - Merge master >> - skip archiving full module graph is there is an incubator module >> - fix

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

2023-10-31 Thread Calvin Cheung
> 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 t

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

2023-10-31 Thread Calvin Cheung
On Tue, 31 Oct 2023 09:09:37 GMT, Alan Bateman wrote: > Thanks, it looks correctly now. Thanks! > > One small question. At ModuleBootstrap L235 we set canArchive as it's okay to > archive under specific restrictions. For completeness, shouldn't this set > canArchive to CDS.isDumpingStaticArc

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

2023-10-31 Thread Alan Bateman
On Tue, 31 Oct 2023 06:17:34 GMT, Calvin Cheung wrote: > I've added the following field in `ArchivedModuleGraph` so that the > `get(String mainModuleName)` will check the `mainModule` before returning > `archivedModuleGraph`. `private static String mainModule;` The `mainModule` > field is also

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

2023-10-31 Thread Alan Bateman
On Tue, 31 Oct 2023 06:11:50 GMT, Calvin Cheung 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

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

2023-10-30 Thread Calvin Cheung
On Sat, 28 Oct 2023 06:37:00 GMT, Alan Bateman wrote: >> 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 no

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

2023-10-30 Thread Calvin Cheung
On Fri, 27 Oct 2023 16:28:10 GMT, Ioi Lam wrote: >> Calvin Cheung has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains ten commits: >> >> - Merge master >> - skip archiving full module graph is there is an incubator module >> - fix

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

2023-10-30 Thread Calvin Cheung
> 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 t

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

2023-10-27 Thread Alan Bateman
On Fri, 27 Oct 2023 19:03:36 GMT, Calvin Cheung wrote: > 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-

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

2023-10-27 Thread Calvin Cheung
On Fri, 27 Oct 2023 17:40:12 GMT, Alan Bateman 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 def

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

2023-10-27 Thread Alan Bateman
On Fri, 27 Oct 2023 16:23:04 GMT, Calvin Cheung 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

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

2023-10-27 Thread Ioi Lam
On Thu, 26 Oct 2023 21:24:46 GMT, Calvin Cheung 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

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

2023-10-27 Thread Calvin Cheung
On Fri, 27 Oct 2023 13:57:38 GMT, Alan Bateman wrote: >> I've pushed another update with the following changes: >> >> - in the VM code, skip archiving full module graph if there's an incubator >> module by checking if the ArchivedBootLayer::archivedBootLayer is available; >> - included your sug

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

2023-10-27 Thread Alan Bateman
On Thu, 26 Oct 2023 21:08:07 GMT, Calvin Cheung wrote: > I've pushed another update with the following changes: > > * in the VM code, skip archiving full module graph if there's an incubator > module by checking if the ArchivedBootLayer::archivedBootLayer is available; I think we still have th

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

2023-10-26 Thread Calvin Cheung
> 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 t

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

2023-10-26 Thread Calvin Cheung
On Sat, 21 Oct 2023 07:51:42 GMT, Alan Bateman wrote: >>> > Yes, because of the following code further up in the same method: >>> >>> I think what you are actually doing here is supporting archiving of the >>> boot layer when the main module transitively depends on an incubator >>> module. We

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

2023-10-26 Thread Calvin Cheung
> 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 t

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

2023-10-21 Thread Alan Bateman
On Fri, 20 Oct 2023 20:24:26 GMT, Calvin Cheung wrote: > I tried the above but got the following build error: > > ``` > Optimizing the exploded image > Error occurred during initialization of boot layer > java.lang.NullPointerException > ExplodedImageOptimize.gmk:39: recipe for target > '/scrat

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

2023-10-21 Thread Alan Bateman
On Sat, 21 Oct 2023 07:42:06 GMT, Alan Bateman wrote: >>> Yes, because of the following code further up in the same method: >> >> I think what you are actually doing here is supporting archiving of the boot >> layer when the main module transitively depends on an incubator module. We >> might

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

2023-10-21 Thread Alan Bateman
On Sat, 21 Oct 2023 06:54:16 GMT, Alan Bateman wrote: > > Yes, because of the following code further up in the same method: > > I think what you are actually doing here is supporting archiving of the boot > layer when the main module transitively depends on an incubator module. We > might have

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

2023-10-20 Thread Alan Bateman
On Fri, 20 Oct 2023 20:22:31 GMT, Calvin Cheung wrote: > Yes, because of the following code further up in the same method: I think what you are actually doing here is supporting archiving of the boot layer when the main module transitively depends on an incubator module. We might have to add m

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

2023-10-20 Thread Calvin Cheung
> 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 t

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

2023-10-20 Thread Calvin Cheung
On Fri, 20 Oct 2023 14:34:52 GMT, Alan Bateman wrote: >> Calvin Cheung has updated the pull request incrementally with one additional >> commit since the last revision: >> >> simplify some code in modules.cpp > > src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java line 472: >

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

2023-10-20 Thread Alan Bateman
On Thu, 19 Oct 2023 15:21:55 GMT, Calvin Cheung 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

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

2023-10-20 Thread Alan Bateman
On Thu, 19 Oct 2023 15:21:55 GMT, Calvin Cheung 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

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

2023-10-20 Thread Alan Bateman
On Thu, 19 Oct 2023 15:21:55 GMT, Calvin Cheung 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

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

2023-10-19 Thread Ioi Lam
On Thu, 19 Oct 2023 15:21:55 GMT, Calvin Cheung 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

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

2023-10-19 Thread Calvin Cheung
On Thu, 5 Oct 2023 16:23:03 GMT, Ioi Lam wrote: >> Calvin Cheung has updated the pull request incrementally with one additional >> commit since the last revision: >> >> simplify some code in modules.cpp > > src/hotspot/share/classfile/modules.cpp line 597: > >> 595: MetaspaceShared::

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

2023-10-19 Thread Calvin Cheung
> 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 t

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

2023-10-18 Thread Calvin Cheung
On Wed, 18 Oct 2023 06:26:24 GMT, Alan Bateman wrote: >> Calvin Cheung has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains five additional >> commit

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

2023-10-18 Thread Calvin Cheung
> 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 t

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

2023-10-18 Thread Calvin Cheung
On Tue, 17 Oct 2023 23:34:56 GMT, Ioi Lam wrote: >> Calvin Cheung has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains five additional >> commits sin

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

2023-10-17 Thread Alan Bateman
On Mon, 2 Oct 2023 22:17:34 GMT, Calvin Cheung 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

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

2023-10-17 Thread Ioi Lam
On Mon, 2 Oct 2023 22:17:34 GMT, Calvin Cheung 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

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

2023-10-17 Thread Alan Bateman
On Thu, 5 Oct 2023 16:18:57 GMT, Ioi Lam wrote: > Maybe we can add a new native method > `jdk.internal.misc.CDS.isBuiltinModule(Module m)` which tests if > `ModuleEntry::_location` starts with `"jrt:"`? There isn't any really notion of "built-in module", they may be modules in the run-time im

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

2023-10-17 Thread Calvin Cheung
On Fri, 6 Oct 2023 06:09:50 GMT, Alan Bateman wrote: >> When a named module is created, we know its location, which is also passed >> to the C code and stored inside the C++ `ModuleEntry` data structure. >> >> https://github.com/openjdk/jdk/blob/a1c9587c27538bda3b0f6745d9c80ff4e1b9a77e/src/java

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

2023-10-17 Thread Ioi Lam
On Wed, 4 Oct 2023 15:59:54 GMT, Calvin Cheung wrote: >> src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java line >> 239: >> >>> 237:// only consider modules from JDK >>> 238:(mainModule.startsWith("jdk.") || >>> mainModule.start

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

2023-10-17 Thread Alan Bateman
On Mon, 2 Oct 2023 22:17:34 GMT, Calvin Cheung 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

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

2023-10-17 Thread Calvin Cheung
On Tue, 3 Oct 2023 07:11:54 GMT, Alan Bateman 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 m

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

2023-10-17 Thread Calvin Cheung
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 regi

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

2023-10-17 Thread Ioi Lam
On Mon, 2 Oct 2023 22:17:34 GMT, Calvin Cheung 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