|By Hari Gottipati||
|February 22, 2012 10:04 AM EST||
Graal is a compiler in Java that will work with Hotspot VM and Maxim VM. Currently the team (Oracle labs VM research team) is focused on integrating it into Hotspot VM and the effort is known as Graals VM. It's a new project to explore implementing a dynamic compiler in Java that can be used in a native JVM such as HotSpot as well as in a meta-circular JVM such as Maxine VM.
The Graal compiler allows Java libraries to extend their functionality to support customizations. For example, it enables custom optimization phases that we cannot achieve with the traditional Java compilers. It provides a Java API to control the compiler phases and it even allows us to introduce new phases, thus it opens the door for efficient implementations of new languages.
In addition, the Graal compiler is a bytecode-agnostic compiler. With Compiler Runtime Interface (CRI), the Graal compiler can work in different VMs written in multiple languages. It can work in Maxine VM as Maxine permits alternate implementations of subsystems such as compilation and GC, whereas Hotspot VM needs an adapter to permit the alternate compilation to be plugged-in.
Graal JVM is going to be a meta-circular JVM, meaning it will be implemented in Java and Java code runs on itself without requiring an additional virtual machine.
Traditionally JVMs are written in C or C++. Java implementation enables seamless integration between a virtual machine and application resources such as objects and threads.Think about coding in Java, compiling it using a compiler written in Java, and running it in a JVM, which is again written in Java- it's Java all the way and imagine the seamless integration between an application and a VM.