On Tue, 29 Apr 2025 04:50:42 GMT, Ioi Lam <ik...@openjdk.org> wrote: > This is the implementation of the draft [JEP: Ahead-of-time Command Line > Ergonomics](https://bugs.openjdk.org/browse/JDK-8350022) > > - Implemented new flag `AOTCacheOutput`, which can be used to create an AOT > cache using the "one-command workflow" > - Added processing of the `AOT_TOOL_OPTIONS` environment variable that can > supply extra VM options when creating an AOT cache > - Added `%p` substitution for `AOTCache`, `AOTCacheOutput`, and > `AOTConfiguration` options > > Please see the [JEP](https://bugs.openjdk.org/browse/JDK-8350022) and > [CSR](https://bugs.openjdk.org/browse/JDK-8356010) for detailed specification. > > Examples: > > > # Create an AOT cache with a single command: > $ java -cp HelloWorld.jar -XX:AOTMode=record -XX:AOTCacheOutput=foo.aot > HelloWorld > Hello World > Temporary AOTConfiguration recorded: foo.aot.config > Launching child process /usr/bin/java to assemble AOT cache foo.aot using > configuration foo.aot.config > Picked up JAVA_TOOL_OPTIONS: -Djava.class.path=HelloWorld.jar > -XX:AOTCacheOutput=foo.aot -XX:AOTConfiguration=foo.aot.config > -XX:AOTMode=create > Reading AOTConfiguration foo.aot.config and writing AOTCache foo.aot > AOTCache creation is complete: foo.aot 10240000 bytes > > # Create logging file for the AOT cache assembly phase > $ export AOT_TOOL_COMMAND=-Xlog:cds:file=log.txt > $ java -cp HelloWorld.jar -XX:AOTMode=record -XX:AOTCacheOutput=foo.aot > HelloWorld > > > Note: the child process is launched with Java API because the HotSpot native > APIs are not sufficient (no way to set env vars for child process).
Few comments. JEP and CSR call env var :`JAVA_AOT_OPTIONS`. This description and changes call it `AOT_TOOL_OPTIONS`. Please, fix. src/hotspot/share/cds/metaspaceShared.cpp line 1068: > 1066: } > 1067: > 1068: // Pass all arguments. These include those from JAVA_TOOL_OPTIONS and > _JAVA_OPTIONS. `_JAVA_OPTIONS`. Do you mean `JAVA_AOT_OPTIONS`? src/hotspot/share/cds/metaspaceShared.cpp line 1071: > 1069: for (int i = 0; i < Arguments::num_jvm_args(); i++) { > 1070: const char* arg = Arguments::jvm_args_array()[i]; > 1071: if (strncmp("-XX:AOTMode", arg, 11) == 0) { In arguments.cpp you do `strncmp("-XX:AOTMode=", arg, 12) == 0`. I think you need to be consistent. src/java.base/share/classes/jdk/internal/misc/CDS.java line 510: > 508: > 509: Map<String, String> env = pb.environment(); > 510: env.put("JAVA_TOOL_OPTIONS", sb.toString()); What about `JAVA_AOT_OPTIONS`? ------------- PR Review: https://git.openjdk.org/jdk/pull/24942#pullrequestreview-2804218715 PR Comment: https://git.openjdk.org/jdk/pull/24942#issuecomment-2839405664 PR Review Comment: https://git.openjdk.org/jdk/pull/24942#discussion_r2066881980 PR Review Comment: https://git.openjdk.org/jdk/pull/24942#discussion_r2066888741 PR Review Comment: https://git.openjdk.org/jdk/pull/24942#discussion_r2066892210