RFR: 8340114: Remove outdated SelectVersion() function from the launcher and update the code comments explaining the code flow [v2]

Jaikiran Pai jpai at openjdk.org
Mon Sep 16 06:19:05 UTC 2024


On Mon, 16 Sep 2024 01:08:19 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   typos
>
> src/java.base/share/native/libjli/java.c line 38:
> 
>> 36:  * One job of the launcher is to remove command line options which the
>> 37:  * vm does not understand and will not process. These options include
>> 38:  * options which select which style of vm is run (e.g. -client and
> 
> Aren't these the only options now?

Right now, in mainline, the launcher code in `CheckJvmType` function additionally also checks for the presence of `-XXaltjvm` launcher option. Just like for `-server`, `-client` options, this `CheckJvmType` function also strips the `-XXaltjvm` option from the options that are passed along to the JVM.

Specifically, in mainline, right now the following appears to be functional:


<JDK_24>/bin/java -XXaltjvm=<JDK_22>/lib/server/  -version

will load and print the Java 22 VM output:


openjdk version "22" 2024-03-19
OpenJDK Runtime Environment (build 22+36-2370)
OpenJDK 64-Bit Server VM (build 22+36-2370, mixed mode, sharing)


i.e. the launcher from mainline JDK launches the altjvm from JDK 22. `CheckJvmType` in the launcher code, is where this parsing and stripping of `-XXaltjvm` is currently happening. 

(There's also some hotspot VM side code which appears to be parsing a `-Dsun.java.launcher.is_altjvm=` option to detect this `-XXaltjvm` usage, but as far as I can see the launcher no where sets this `-Dsun.java.launcher.is_altjvm=` when `-XXaltjvm` is used. So, I think, this needs a separate investigation of its own)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20997#discussion_r1760584301


More information about the core-libs-dev mailing list