Oracle Introduces A Polyglot Virtual Machine Reckoned As GraalVM

Posted By : Raj Wadhwa | 31-Oct-2018



Imagine a world where you have one single ecosystem, to drive all the species (in their individually natural habitat).
Sounds interesting right.

Oracle worked on a similar platform, and the mission and motive were to design or develop a virtual machine for running applications written in different types of Programming languages like Scala, Java, Kotlin, Javascript etc. and Low-Level VM Based languages like C++ & C.
GraalVM enables the interoperability in an environment of shared runtime. And by doing this, it removes the isolation between various Programming languages.
It can be run in the varied contexts of Nodejs, RDBMS databases (based on the above-mentioned languages - Oracle Database or MySQL), OpenJDK etc.

After this basic definition of GraalVM, Now I can provide a better definition of GraalVM which is as follows :

GraalVM is an embeddable highly efficient polyglot Virtual Machine that is capable of running:

  • Interpreted languages, such as JavaScript, Ruby, R, and Python
  • JVM-based languages, such as Java, Scala, Kotlin, and Groovy
  • Native languages that work with LLVM, such as C, C++, Rust, and Swift

Building Blocks of GraalVM

GraalVM is an Open-Source Project, mostly written Java. Hence, you don't need to be an expert in the native code to get used to the working of GraalVM.
Let's look at what GraalVM is made up of.

A Just-In-Time Compiler, Graal

Such a VM is nothing without a high-performance VM. So, the backbone of this VM is a compiler that can be used both as a JIT-Compiler and static flavour of the ahead-of-time compiler.
This compiler is called Graal.

It implements many optimizations like :

  • Constant folding
  • Subexpression elimination
  • dead-code elimination

However, the areas where it really comes out with flying colours are:

  • Inkling Algorithm
  • Escape Analysis Algorithm


Next ingredient of any good VM is that we need something that can understand different types of languages.
For GraalVM, Truffle serves this part of the recipe. Truffle offers an API that you can use to implement
an interpreter of a language based on the abstract syntax trees (ASTs) of the source programs.
Evaluating ASTs is a relatively straightforward way to execute a program, so working on interpreter is much easier than creating an optimizing compiler.

Native Images

Last part of such an amazing recipe is that we need a way to prepare images so that they can be run in the containerized environment.
For GraalVM, this is done by SubstrateVM that helps in converting the apps written in any language to such native images that can be executed directly without the need of the JVM, don't need to load and initialize java images and hence the startup is very fast.

About Author

Author Image
Raj Wadhwa

Raj is a Sr. Project Manager with experience of almost 7 Years. He is an avid Reader, Programmer, Loves playing Football, and a Foodie.

Request for Proposal

Name is required

Comment is required

Sending message..