JVM Runtime Mode
When running programs in the JVM mode, in the context of Oracle JDK, GraalVM Enterprise adds the GraalVM Compiler as the top tier just-in-time (JIT) compiler.
This JIT compiler is used through the JVMCI interface, the Java Virtual Machine Compiler Interface, added to the OpenJDK in the JEP 243.
GraalVM backports JVMCI to the JDK8. With the JVMCI help, JVM applications run on the Java HotSpot VM with a different JIT compiler enabled. At runtime, the application is loaded and executed normally on the JVM. The JVM passes bytecode to the GraalVM compiler which compiles that to the machine code and returns that to the JVM.
GraalVM Enterprise compiler takes bytecode as input and compiles that to the machine code. Technically, with the right combination of the command line parameters, the GraalVM compiler can be disabled and the application would still run properly. Consult the Compiler Configuration Options for more details.
Any application that Java HotSpotVM runs can be run on GraalVM Enterprise. In the same way as GraalVM Enterprise can execute programs written in JVM-based languages, it can load and run the Truffle Language Implementation framework (henceforth Truffle framework), which is itself a Java program – a collection of jar files.
By having access to the Truffle framework, the JVM can load and use the interpreters for programming language written with this Language Implementation framework. The interpreters are Java programs and thus can run on the JVM.
Oracle GraalVM Enterprise can use the GraalVM JavaScript interpreter and the GraalVM LLVM bitcode interpreter in the distribution. Additionally, the support for Ruby, R and Python interpreters can be added to the Oracle GraalVM distribution. With access to the interpreters GraalVM can load and execute programs written in the supported languages.
The Truffle Language Implementation framework offers APIs for writing interpreters for the programming languages. These get optimized at runtime into efficient machine code for executing loaded programs. The optimization the Truffle framework imposes on the interpreters sometimes require certain APIs and capabilities from the JIT compiler, incidentally, the GraalVM compiler has these required capabilities.
The Truffle framework and the interpreters created with it can be run on the JVM without the GraalVM compiler, but due to the limits of the applicable optimizations in that case, performance might be worse than in the presence of the GraalVM compiler.