RFR: 8340398: [JVMCI] Unintuitive behavior of UseJVMCICompiler option
Tomáš Zezula
duke at openjdk.org
Mon Sep 23 07:26:36 UTC 2024
On Sun, 22 Sep 2024 11:46:49 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
>> Disabling the JVMCI compiler with `-XX:-UseJVMCICompiler` not only deactivates JVMCI-based CompileBroker compilations but also prevents the loading of the libjvmci compiler. While this works as expected for CompileBroker compilations, it poses issues for the Truffle compiler. When `-XX:-UseJVMCICompiler` is used, Truffle falls back to the jargraal compiler, if available. This behavior may be confusing for Truffle users.
>>
>> Expected behavior:
>>
>> With `-XX:+UseGraalJIT`, both CompileBroker compilations and Truffle compilations should utilize the libjvmci compiler, if available.
>> With `-XX:+EnableJVMCI`, CompileBroker compilations should use the C2 compiler, while only Truffle compilations should leverage the libjvmci compiler, if available.
>
> src/hotspot/share/jvmci/jvmci_globals.cpp line 82:
>
>> 80: CHECK_NOT_SET(LibJVMCICompilerThreadHidden, UseJVMCICompiler)
>> 81:
>> 82: if (EnableJVMCI) {
>
> This needs to be `EnableJVMCI || UseJVMCICompiler` (since deriving `EnableJVMCI` from `UseJVMCICompiler` is only done [below](https://github.com/openjdk/jdk/blob/ab06a878f888827026424530781f0af414a8a611/src/hotspot/share/jvmci/jvmci_globals.cpp#L96)).
I see, `FLAG_SET_DEFAULT(EnableJVMCI, true)` on [line 99](https://github.com/openjdk/jdk/blob/78f576192e815f957db93f5f8cb3763a35474381/src/hotspot/share/jvmci/jvmci_globals.cpp#L99).
Maybe moving this block
if (!FLAG_IS_DEFAULT(EnableJVMCI) && !EnableJVMCI) {
jio_fprintf(defaultStream::error_stream(),
"Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n");
return false;
}
FLAG_SET_DEFAULT(EnableJVMCI, true);
in front of my change makes it more readable.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21069#discussion_r1770881033
More information about the hotspot-compiler-dev
mailing list