Introduction to GraalVM

GraalVM is a high-performance runtime that provides significant improvements in application performance and efficiency which is ideal for microservices. It is designed for applications written in Java, JavaScript, LLVM-based languages such as C and C++, and other dynamic languages. It removes the isolation between programming languages and enables interoperability in a shared runtime.

GraalVM system diagram

The preceding diagram illustrates the architecture of GraalVM as an open ecosystem.

The virtualization layer represents programming languages, provided by GraalVM. The execution of guest programming languages, namely JavaScript, Ruby, R, Python and LLVM bitcode, in the same runtime as the host JVM-based application is now down-to-earth. The host language and guest languages can directly interoperate with each other and pass data back and forth in the same memory space.

The bottom part demonstrates the applicability range. GraalVM can either run standalone, be embedded as part of the OpenJDK or Node.js platforms, or even execute inside Oracle Database.

GraalVM Distributions #

GraalVM is available as GraalVM Community and GraalVM Enterprise editions. GraalVM Community editions are based on OpenJDK version 1.8.272 and on OpenJDK version 11.0.9. GraalVM Enterprise editions are based on Oracle JDK version 1.8.0_271 and on Oracle JDK version 11.0.9.

GraalVM distributions are available for Linux, macOS and Windows platforms on AMD64 systems and for the Linux platform on AARCH64 systems. The GraalVM distribution for AArch64, graalvm-ce-java11-linux-aarch64-20.3.0, is currently under development and is provided for evaluation and testing use on GitHub.

All editions are shipped as a .tar.gz file. For installation, it is sufficient to unpack the respective archive and set the JAVA_HOME variable on the unpacked directory. Continue reading to the Getting Started with GraalVM guide.

Distribution Components List #

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

Core Components #

Runtimes

  • Java HotSpot VM with the GraalVM compiler enabled as the top-tier just-in-time (JIT) compiler
  • Node.js JavaScript runtime environment
  • LLVM runtime to execute programming languages that can be transformed to LLVM bitcode

Libraries (jar files)

  • GraalVM Compiler – a dynamic just-in-time compiler that improves efficiency and speed of applications through unique approaches to code analysis and optimization
  • JavaScript interpreter – an ECMAScript compliant JavaScript engine
  • LLVM bitcode interpreter – an implementation of the lli tool to directly execute programs from LLVM bitcode
  • GraalVM Polyglot API – the APIs for combining programming languages in a shared runtime

Utilities

  • JavaScript REPL with the GraalVM JavaScript interpreter
  • LLVM bitcode interpreter command line utility
  • GraalVM Updater utility to install and manage additional components

Additional Components #

GraalVM base installation can be extended with the additional components:

  • Native Image – a technology to compile a JVM-based application ahead-of-time into native code. In GraalVM Community Native Image is distributed under the GPL 2 with Classpath Exception license
  • LLVM toolchain – a set of tools and APIs for compiling native programs to bitcode that can be executed with the GraalVM LLVM runtime
  • Python interpreter – an implementation of the Python 3.8.5 language
  • Ruby interpreter – an implementation of the Ruby 2.6.6 programming language
  • R interpreter – a GNU R 3.6.1 compatible implementation of the R programming language
  • GraalWasm – an implementation of the WebAssembly (Wasm) programming language

Note: Python, R, Ruby and Wasm are experimental and not recommended for production use at this time.

GraalVM Documentation #

Whether you are here to try running an application with GraalVM for the first time or ready to start coding with the GraalVM Polyglot APIs, check out our documentation to help you on your way.

Alternatively you can have a look at GraalVM SDK Java API Reference and GraalVM Truffle Java API Reference. For example:

  • The Polyglot Package allows you to configure and run polyglot applications.
  • The Proxy Package allows you to mimic the guest language objects using proxies.
  • The IO Package allows you to customize the file system access of languages.
  • The Truffle API allows to implement your own Truffle based language.

If you cannot find the answer you need or have a troubleshooting query, get in touch with us.