RFR: 8340398: [JVMCI] Unintuitive behavior of UseJVMCICompiler option

Doug Simon dnsimon at openjdk.org
Sun Sep 22 10:47:35 UTC 2024


On Wed, 18 Sep 2024 16:53:40 GMT, Tomáš Zezula <duke 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 84:

> 82:   if (EnableJVMCI) {
> 83:     if (FLAG_IS_DEFAULT(UseJVMCINativeLibrary) && !UseJVMCINativeLibrary) {
> 84:       char path[JVM_MAXPATHLEN];

This check for enabling `UseJVMCINativeLibrary` should really be:

   if (UseJVMCICompiler) {
     if (FLAG_IS_DEFAULT(UseJVMCINativeLibrary) && !UseJVMCINativeLibrary) {
-      char path[JVM_MAXPATHLEN];
-      if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), JVMCI_SHARED_LIBRARY_NAME)) {
+      if (JVMCI::shared_library_exists()) {
         // If a JVMCI native library is present,

but I will address that as part of [JDK-8340576](https://bugs.openjdk.org/browse/JDK-8340576).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21069#discussion_r1770520057


More information about the hotspot-compiler-dev mailing list