RFR: 8340114: Remove outdated SelectVersion() function from the launcher and update the code comments explaining the code flow [v5]
David Holmes
dholmes at openjdk.org
Mon Sep 16 12:12:06 UTC 2024
On Mon, 16 Sep 2024 06:16:56 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> 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)
The property is used by the gtest launcher - see comments in [JDK-8171508](https://bugs.openjdk.org/browse/JDK-8171508)
This is all a lot more complicated than I had thought it was.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20997#discussion_r1761027867
More information about the core-libs-dev
mailing list