Oracle's Graal project empowers language creation on the JVM

New compiler lets developers write JVM-powered runtimes and compilers for other languages

Apart from all of the other news coming out of Oracle's JavaOne and OpenWorld conferences, one development has major implications for Java programmers and the JVM.

Oracle has released the first prototype version of a Java project that will allow programmers to write JVM-powered runtimes and compilers for other languages -- in Java itself.

According to its OpenJDK project page, the project known as Graal VM aims to expose VM functionality (as in the JVM) by way of Java APIs.

"We want to make it feasible to write in Java a dynamic compiler and interpreter for a language runtime," says the project page. "Building on the compiler, we aim to develop a multi-language interpreter framework. Java will be just one member in the family of supported languages. The use of partial evaluation will allow the framework to deliver competitive performance."

The Graal compiler is only one half of the equation. The other half is a language framework called Truffle, which is used to build the implementations for different languages that would run with Graal.

A number of Truffle-based languages for Graal are already available. An ECMAScript 5.1-compliant JavaScript engine named Truffle/JS is bundled with the technology preview version of Graal and provides "peak performance competitive to the leading JavaScript engines" (presumably, Node.js).

Other Truffle-based language projects for use with Graal are under development, including RubyR, and Python, along with implementations of Smalltalk. Yet another project, by Matthias Grimmer, involves an implementation of C in Truffle as well.

Graal has been in the works since at least 2012, when it was originally positioned as the compiler portion of another project, Oracle's next-generation Maxine JVM. The released version works with Oracle's existing, current-generation HotSpot JVM, but in theory could work with either JVM.

In a slide deck presented late last year, Thomas Wuerthinger, senior research manager at Oracle, provided details about the performance boon the Graal/Truffle combo provided for various languages. The preliminary results at the time were mixed but competitive with other implementations, and some individual benchmarks far outperformed others. Ruby seemed to have the best overall speedup, matched more or less by the existing Topaz project.

This story, "Oracle's Graal project empowers language creation on the JVM" was originally published by InfoWorld.