RFR: 8345826: Do not automatically resolve jdk.internal.vm.ci when libgraal is used [v3]
Ioi Lam
iklam at openjdk.org
Fri May 16 15:42:56 UTC 2025
On Fri, 16 May 2025 15:26:31 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
>> I ran a recent build of Oracle JDK 25 that has libjvmcicompiler.so (not including your changes):
>>
>>
>> $ ./bin/java -XX:+UnlockExperimentalVMOptions -XX:+UseGraalJIT -XX:+PrintFlagsFinal --version | \
>> egrep '(EnableJVMCI)|(UseJVMCICompiler)|(UseJVMCINativeLibrary)'
>> bool EnableJVMCI = true {JVMCI product} {default}
>> bool EnableJVMCIProduct = true {JVMCI product} {command line}
>> bool UseJVMCICompiler = true {JVMCI product} {default}
>> bool UseJVMCINativeLibrary = true {JVMCI product} {default}
>> $ ./bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+PrintFlagsFinal --version | \
>> egrep '(EnableJVMCI)|(UseJVMCICompiler)|(UseJVMCINativeLibrary)'
>> bool EnableJVMCI = true {JVMCI experimental} {command line}
>> bool EnableJVMCIProduct = false {JVMCI experimental} {default}
>> bool UseJVMCICompiler = false {JVMCI experimental} {default}
>> bool UseJVMCINativeLibrary = true {JVMCI experimental} {default}
>>
>>
>> So If you specify only `-XX:+EnableJVMCI` in the command-line, `UseJVMCINativeLibrary` will be true. As a result, with your latest version, the `jdk.internal.vm.ci` module is not added.
>>
>> If you have an app that wants to use the jdk.internal.vm.ci API, you must specify both `-XX:+EnableJVMCI` and `
>> --add-modules=jdk.internal.vm.ci`. Is this intentional?
>
>> If you have an app that wants to use the jdk.internal.vm.ci API, you must specify both -XX:+EnableJVMCI and --add-modules=jdk.internal.vm.ci.
>
> You should only have to specify `--add-modules=jdk.internal.vm.ci` and that now sets `+EnableJVMCI`. If you also want libgraal to be used as the JIT (instead of C2), then you need to add `-XX:+UseGraalJIT`.
>
> For the Truffle on Oracle JDK, this means:
> * `--add-modules=jdk.internal.vm.ci`: Use C2 for JIT ("hosted") compilation and libgraal for Truffle ("guest") compilation
> * `--add-modules=jdk.internal.vm.ci -XX:+UseGraalJIT`: Use libgraal for both JIT and Truffle compilation
Ah I forgot the setting on EnableJVMCI to true. Thanks for the explanation.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25240#discussion_r2093283370
More information about the graal-dev
mailing list