corretto / corretto-21

GNU General Public License v2.0
74 stars 21 forks source link

Flag -XX:+UseGraalJIT does not work #36

Closed luizhespanha closed 10 months ago

luizhespanha commented 10 months ago

Describe the bug

When try to use the flag -XX:+UseGraalJIT the JVM crashes

To Reproduce

Just add the flag. The error message received is: JVMCI compiler 'graal' specified by jvmci.Compiler not found

Expected behavior

My expectation is that it should work, since in Java 21 the Graal JIT is an alternative to the original JVM JIT. If I'm wrong, what's the rationale to Corretto do not support the Graal JIT?

navyxliu commented 10 months ago

Hi, Corretto is a distribution of OpenJDK, not GraalVM SDK.

UseGraalJIT is a shorthand of 'use CI and use Graal JIT as the ci compiler'. however, OpenJDK has not integrated Graal JIT yet. Therefore, the option doesn't make Graal JIT available in any jdk21 distro.

My expectation is that it should work, since in Java 21 the Graal JIT is an alternative to the original JVM JIT. If I'm wrong, what's the rationale to Corretto do not support the Graal JIT?

Not jdk21. This is the general roadmap. It takes time. Corretto team align with the openjdk community.

WithEnoughCoffee commented 10 months ago

Hello, Thank you for your post. Both OpenJDK hasn't supported -XX:+UseGraalJIT since Java 11 and neither has Corretto. Good news Oracle has released Graa CE to OpenJDK but the interrogation work hasn't been completed yet. Heres a link if you'd like to follow up: https://www.graalvm.org/2022/openjdk-announcement/.

simonis commented 10 months ago

@luizhespanha note that you can use the GraalVM compiler as JIT compiler with Corretto 21, you just have to download it separately and add it the module path:

$ ./corretto-21/bin/java -XX:+UnlockExperimentalVMOptions -XX:+UseGraalJIT -Xcomp --upgrade-module-path=compiler-23.1.1.jar:word-23.1.1.jar:collections-23.1.1.jar:truffle-compiler-23.1.1.jar -XX:+PrintCompilation -version
...
   8046 6099       1       org.graalvm.compiler.lir.util.IndexedValueMap::isEmpty (93 bytes)
   8046 6100       1       org.graalvm.compiler.lir.util.IndexedValueMap::putAll (420 bytes)
   8048 6078 % !   1       org.graalvm.compiler.lir.RedundantMoveElimination$Optimization::solveDataFlow @ 304 (523 bytes)
   8050 5996 % !   1       org.graalvm.compiler.lir.alloc.lsra.LinearScanLifetimeAnalysisPhase::computeGlobalLiveSets @ 114 (608 bytes)
   8050 4949   !   3       java.lang.ref.NativeReferenceQueue::enqueue (20 bytes)   made not entrant
   8051 4991    b  4       java.lang.Thread::run (23 bytes)
...
openjdk version "21" 2023-09-19 LTS
OpenJDK Runtime Environment Corretto-21.0.0.35.1 (build 21+35-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.0.35.1 (build 21+35-LTS, compiled mode)
...
 157648 12432       4       java.lang.invoke.LambdaForm::argument (27 bytes)
 157648 12432       4       java.lang.invoke.LambdaForm::argument (27 bytes)   COMPILE SKIPPED: in JVMCI shutdown (not retryable)

You can get the GraalVM compiler and its dependencies e.g. from MavenCentral: https://mvnrepository.com/artifact/org.graalvm.compiler/compiler/23.1.1