Graal - New JIT Compiler and Polyglot Runtime for the JVM
Graal is a new just-in-time compiler for the JVM focused on peak performance and multi-language support. Graal offers performance advantages not only to Java code, but also to scripting languages such as JavaScript, Ruby, and R. Additionally, it enables the execution of native code on the JVM via an LLVM-based front end (project Sulong). Languages are executed by Graal via the Truffle framework, which comes with seamless interoperability and polyglot debugging and profiling functionality.
Usage
A
technology preview download for Java 8 is available, and Graal will be usable as an add-on to Java 9 soon. The current release is either a standalone JDK or JRE which incorporates Graal and language runtimes for JavaScript, Ruby, and R. The bin directory contains:
- java - Runs the JVM with Graal as the default compiler.
- graalvm - Runs the JVM in polyglot mode with JavaScript, Ruby, and R as available languages.
- js - Runs a JavaScript console with Graal.js.
- node - Drop-in replacement for node.js with Graal.js as the executing JavaScript engine.
- ruby - Drop-in replacement for MRI Ruby with TruffleRuby as the executing Ruby engine.
- R - Drop-in replacement for GNU R with FastR as the executing R engine.
Benefits
- Performance - Graal incorporates our research on compiler technology, and offers better peak performance on some workloads than a traditional JVM.
- Polyglot - Java, JavaScript, Ruby, and R are all available at competitive performance within the same execution environment.
- Interoperability - Languages executed in Graal can call each other without overhead and libraries from other languages can be used.
- Embeddability - Embed dynamic languages and native code with sandboxing capabilities.
- Tooling - Graal benefits from JVM-based tooling and all languages share common tooling such as debugging and profiling.
JVMCI JDK 8
In addition to the above JDK that includes Graal and additional language runtimes, an alternative JDK is available on the downloads page that only includes JVMCI and can be used for experimenting with Graal or other JVMCI based compilers without embedding the JVMCI compiler in the JDK.