Graal and Hotspot

Doug Simon @ Oracle doug.simon at oracle.com
Tue Feb 12 15:57:33 PST 2013


In the C++ HotSpot code, Graal is a(nother) subclass of AbstractCompiler. Most of its code resides in these files/directories:

src/share/vm/graal
src/cpu/x86/vm/graal
src/cpu/sparc/vm/graal

That is, we've tried to match the code placement conventions of c1 and opto as much as possible.

The VM can be built in a number configurations:

1. To exclusively use Graal for servicing compilation requests (e.g., upon counter overflow for hot methods in the interpreter). In this configuration, c1 and c2 are completely omitted from the VM binary. This configuration is built with the 'mx build' command and is run with the 'mx vm <VM options> class <args>' command.
2. To have the Graal extension points in the binary available so that Graal can be used for explicit compilation and code installation.  In this configuration, c1 and c2 are present and are used for VM requested compilations. That is, the VM is almost like a stock HotSpot build except that the Graal compiler can be used from Java code. For example, look at com.oracle.graal.compiler.test.CompiledMethodTest. This configuration is built with the 'mx --vm server build' command and is run with the 'mx --vm server vm <VM options> class <args>' command. 
3. A stock HotSpot build with none of the Graal code included. This configuration is built with the 'env OMIT_GRAAL= mx --vm server build' command and is run with the 'mx --server vm <VM options> class <args>' command. This cannot coexist with config 2 and so you need to issue a 'mx clean --no-java' command when switching between config 2 and 3.

For the most part, we have guarded all Graal modifications to the VM with '#ifdef GRAAL' or '#ifdef GRAALVM'.

-Doug

On Feb 13, 2013, at 7:49 AM, "Venkatachalam, Vasanth" <Vasanth.Venkatachalam at amd.com> wrote:

> Hi,
> 
> The Graal webpage says that the Graal VM is a modified version of Hotspot that uses Graal as the compiler instead of C1 or C2.
> 
> Can someone explain at a high-level which components of Hotspot are intact and which ones have been modified?
> I see a number of API routines relating to hotspot (com.oracle.graal.hotspot.server).
> 
> Vasanth
> 
> 
> 
> 



More information about the graal-dev mailing list