Search code examples
javajvmjava-9java-11graalvm

which compiler is used when -server -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler


My JVM has -server option, I believe it enables JVM to use C2 compiler which is meant to use for server applications which tend to run longer than client counterparts. However, GRAAL JIT (which is enabled by -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler) is meant to replace C2 and my JVM starts even when I give both options like below.

-server -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler

which compiler does it end up using? Graal JIT or C2?


Solution

  • That -server is simply ignored, read this answer for example. What you can do is run with some extra commands:

     java -XX:+UnlockExperimentalVMOptions 
          -XX:+EnableJVMCI 
          -XX:+UseJVMCICompiler  
          -Dgraal.ShowConfiguration=info  // this
          -XX:+EagerJVMCI  // and this matters
    

    The result is will contain:

    Using Graal compiler configuration 'community' .....