/ɡreɪl viː ɛm/

noun … “Polyglot JVM for high-performance execution.”

GraalVM is a high-performance, polyglot runtime that extends the Java Virtual Machine to execute code from multiple languages including Java, JavaScript, Python, Ruby, R, and LLVM-based languages. It integrates a just-in-time (JIT) compiler and an ahead-of-time (AOT) native image generator, enabling fast startup, low memory footprint, and efficient execution across languages. GraalVM supports interoperability between languages, allowing functions, objects, and data structures to cross language boundaries seamlessly.

Key characteristics of GraalVM include:

  • Polyglot execution: runs multiple languages within a single runtime environment, sharing data and code.
  • High-performance JIT compilation: optimizes code dynamically for improved execution speed.
  • Native image generation: compiles applications ahead-of-time into standalone binaries with minimal runtime overhead.
  • Language interoperability: objects and functions can be passed across languages without serialization.
  • Integration with existing JVM ecosystems: supports standard Java libraries, frameworks, and tools.

Workflow example: A developer can write a backend service where computationally intensive algorithms are implemented in Python, while the high-throughput request handling remains in Java. Using GraalVM, the Python functions can be invoked directly from Java without bridging or REST calls, maintaining type safety and reducing latency.

import org.graalvm.polyglot._

val context = Context.create()
context.eval("python", "def square(x): return x * x")
val squareFunc = context.getBindings("python").getMember("square")
println(squareFunc.execute(10))  -- Output: 100

Conceptually, GraalVM is like a multilingual conference hall where speakers from different languages communicate directly and efficiently. The runtime ensures everyone understands each other, optimizes conversations on the fly, and can even convert the discussion into a compact, pre-prepared report for fast delivery.

See JVM, Java, Polyglot Programming, Graal.