Table of Contents

Introduction to GraalVM

GraalVM is a high-performance JDK designed to accelerate the execution of applications written in Java and other JVM languages while also providing runtimes for JavaScript, Python, and a number of other popular languages. GraalVM offers two ways to run Java applications: on the HotSpot JVM with Graal just-in-time (JIT) compiler or as an ahead-of-time (AOT) compiled native executable. GraalVM’s polyglot capabilities make it possible to mix multiple programming languages in a single application while eliminating foreign language call costs.

This page provides an architectural overview of GraalVM and its runtime modes, supported platforms, available distributions, core and additional functionalities, and support levels for various features.

GraalVM Architecture

GraalVM adds an advanced just-in-time (JIT) optimizing compiler, which is written in Java, to the HotSpot Java Virtual Machine.

In addition to running Java and JVM-based languages, GraalVM’s language implementation framework (Truffle) makes it possible to run JavaScript, Ruby, Python, and a number of other popular languages on the JVM. With GraalVM Truffle, Java and other supported languages can directly interoperate with each other and pass data back and forth in the same memory space.

Runtime Modes

GraalVM is unique as a runtime environment offering several modes of operation: JVM runtime mode, Native Image, Java on Truffle (the same Java applications can be run on either).

JVM Runtime Mode

When running programs on the HotSpot JVM, GraalVM defaults to the GraalVM compiler as the top-tier JIT compiler. At runtime, an application is loaded and executed normally on the JVM. The JVM passes bytecodes for Java or any other JVM-native language to the compiler, which compiles that to the machine code and returns it to the JVM. Interpreters for supported languages, written on top of the Truffle framework, are themselves Java programs that run on the JVM.

Native Image

Native Image is an innovative technology that compiles Java code into a standalone native executable or a native shared library. The Java bytecode that is processed during the build of a native executable includes all application classes, dependencies, third party dependent libraries, and any JDK classes that are required. A generated self-contained native executable is specific to each individual operating systems and machine architecture that does not require a JVM.

Java on Truffle

Java on Truffle is an implementation of the Java Virtual Machine Specification, built with the Truffle language implementation framework. It is a complete Java VM that includes all core components, implements the same API as the Java Runtime Environment library, and reuses all JARs and native libraries from GraalVM.

Available Distributions

GraalVM is available as GraalVM Enterprise and GraalVM Community editions and includes support for Java 11 and Java 17. GraalVM Enterprise is based on Oracle JDK while GraalVM Community is based on OpenJDK.

GraalVM is available for Linux and macOS on x86 64-bit and AArch64 systems, and for Windows on x86 64-bit architecture. Depending on the platform, the distributions are shipped as .tar.gz or .zip archives. See the Getting Started guide for installation instructions.

Distribution Components List

GraalVM consists of core and additional components. The core components enable using GraalVM as a runtime platform for programs written in JVM-based languages or embeddable polyglot applications.

Core Components

  • Java HotSpot VM
  • Graal compiler - the top-tier JIT compiler
  • Polyglot API – the APIs for combining programming languages in a shared runtime
  • GraalVM Updater - a utility to install additional functionalities

Additional Components

GraalVM core installation can be extended with more languages runtimes and utilities.

Tools/Utilities:

  • Native Image – a technology to compile an application ahead-of-time into a native platform executable.
  • LLVM toolchain – a set of tools and APIs for compiling native programs to bitcode that can be executed on GraalVM.

Runtimes:

  • JavaScript runtime with JavaScript REPL with the JavaScript interpreter
  • Node.js – the Node.js 16.14.2 runtime for JavaScript
  • LLVM runtime with lli tool to directly execute programs from LLVM bitcode
  • Java on Truffle – a JVM implementation built upon the Truffle framework to run Java via a Java bytecode interpreter.
  • Python – Python 3.8.5 compatible
  • Ruby – Ruby 3.0.3 compatible
  • R – GNU R 4.0.3 compatible
  • GraalWasm – WebAssembly (Wasm)

Licensing and Support

GraalVM Community Edition is open source software built from the sources available on GitHub and distributed under version 2 of the GNU General Public License with the “Classpath” Exception, which are the same terms as for Java. Check the licenses of individual GraalVM components which are generally derivative of the license of a particular language and may differ. GraalVM Community is free to use for any purpose and comes with no strings attached, but also no guarantees or support.

Features Support

GraalVM technologies are distributed as production-ready and experimental.

Experimental features are being considered for future versions of GraalVM and are not meant to be used in production. The development team welcomes feedback on experimental features, but users should be aware that experimental features might never be included in a final version, or might change significantly before being considered production-ready.

The following table lists production-ready and experimental features in GraalVM Community Edition 22.1 by platform.

Feature Linux AMD64 Linux AArch64 macOS AMD64 macOS AArch64 Windows AMD64
Native Image stable stable stable experimental stable
LLVM runtime stable stable stable experimental not available
LLVM toolchain stable stable stable experimental not available
JavaScript stable stable stable experimental stable
Node.js stable stable stable not available stable
Java on Truffle stable experimental experimental experimental experimental
Python experimental not available experimental not available not available
Ruby experimental experimental experimental experimental not available
R experimental not available experimental not available not available
WebAssembly experimental experimental experimental not available experimental

Whether you are new to GraalVM or have little experience using it, continue to Get Started with GraalVM. Install GraalVM on your local machine, try running the examples provided in the guide, or test GraalVM with your workload. After that we suggest you to look at more complex GraalVM Demos on GitHub.

Developers who have GraalVM already installed or have experience using, can skip the getting started guide and proceed to the Reference Manuals for in-depth coverage of GraalVM technologies.

To start coding with the GraalVM Polyglot APIs, check out the GraalVM SDK Java API Reference.

If you cannot find the answer you need in the available documentation or have a troubleshooting query, you can ask for help in a slack channel or submit a GitHub issue.