How to build Graal

Obviously you can download GraalVM/Graal from here:

Oracle Labs GraalVM: Download

But I tried to build Graal.

We need Graal and mx. I used Graal version 0.29.

$ git clone
$ cd ../graal
$ git checkout vm-enterprise-0.29

$ git clone
$ cd mx
$ export PATH=`pwd`:$PATH
$ mx -v      
Welcome to Mx version 5.130.1

It's my understanding that mx is like maven and for complicated use cases, not for application development.

We build a Graal JIT compiler. I use JDK 9.

$ cd graal/compiler

$ export JAVA_HOME=`/usr/libexec/java_home -v 9`
$ mx build
Archiving TRUFFLE_TEST... [dependency updated]

We check a command mx vm.

$ mx vm
使用方法: java [options] <mainclass> [args...]
   または  java [options] -jar <jarfile> [args...]
   または  java [options] -m <module>[/<mainclass>] [args...]
       java [options] --module <module>[/<mainclass>] [args...]

Wow, those are Japanese but you may see your mother language.

To read source code on IDE, run 'mx ideinit'. After running this command emits configurations for Eclipse, IntelliJ IDEA and NetBeans. We can see files such as .classpath, project.xml and .iml.

$ mx ideinit
created /Users/jyukutyo/code/graal/truffle/mxbuild/mx.truffle/eclipse-project-settings

There is a problem. On IntelliJ IDEA the value of SDK is 1.9, so all modules have a error. I changed the value to 9.


IGV can visualize data structures of Graal. Another time I'll try to run visualization.

$ mx igv
Downloading BATIK from ['']
Downloading to /Users/koichi.sakata/.mx/cache/BATIK_122b87ca88e41a415cf8b523fd3d03b4325134a3.jar
 8361163 bytes (100%)
Please select a JDK for running IGV: (version >= 1.8 and < 1.8.0u20 or >= 1.8.0u40)
[1] Java 1.8.0_144 (1.8) from /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
[2] Java 1.7.0_80 (1.7) from /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
[3] <other>

We need to select a JDK for running IGV. I selected [3] and type the path to JDK 9, but I couldn't use JDK 9. I don't know why.

Run unit tests

There are unit tests. We can run them.

$ mx unittest -Dgraal.Dump BC_athrow0
JUnit version 4.12
.Dumping debug output in /Users/jyukutyo/code/graal/compiler/dumps/1510811588804
Time: 1.738

OK (2 tests)

OK. We're ready to dive into Graal!