You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The GraalVM compiler is a dynamic compiler written in Java that integrates with the HotSpot JVM. It has a focus on high performance and extensibility.
4
-
In addition, it provides optimized performance for languages implemented with [Truffle Framework](https://github.com/graalvm/graal/tree/master/truffle)-based languages running on the JVM.
4
+
In addition, it provides optimized performance for languages implemented with [Truffle Framework](../truffle)-based languages running on the JVM.
5
5
For brevity, the GraalVM compiler is often referred to as "the compiler" below.
6
6
7
7
## Setup
@@ -10,8 +10,8 @@ Working with the GraalVM compiler will mean cloning more than one repository and
10
10
recommended to create and use a separate directory:
The compiler depends on a JDK that supports a compatible version of JVMCI ([JVM Compiler Interface](https://bugs.openjdk.java.net/browse/JDK-8062493)).
28
-
There is a JVMCI [port](https://github.com/graalvm/graal-jvmci-8) for JDK 8 and the required JVMCI version is built into the JDK as of JDK 11.
29
-
A JVMCI-enabled JDK 8 can be downloaded from [GitHub](https://github.com/graalvm/openjdk8-jvmci-builder/releases)
30
-
or you can [build](#building-jvmci-jdk8) it yourself.
31
-
32
-
The JVMCI JDKs that Graal is currently tested against are specified in [common.json](../common.json).
33
-
34
-
Most compiler sources are compliant with Java 8. Some sources use API specific to JDK 8 or only introduced in JDK 9.
35
-
These sources are in [versioned projects](https://github.com/graalvm/mx#versioning-sources-for-different-jdk-releases).
36
-
If you don't have a JDK that satisfies the requirement of a versioned project, the project is ignored by mx.
37
-
38
-
If you want to develop on a single JDK version, you only need to define `JAVA_HOME`. For example:
# Follow instructions emitted by the above command to set JAVA_HOME
58
31
```
59
-
If you omit `EXTRA_JAVA_HOMES` in the above examples, versioned projects depending on the specified JDK(s) will be ignored.
60
-
Note that `JAVA_HOME` defines the *primary* JDK for development. For instance, when running `mx vm`, this is the JDK that will be used so if you want to run on JDK 11, swap JDK 8 and JDK 11 in `JAVA_HOME` and `EXTRA_JAVA_HOMES`.
61
32
62
-
Now change to the `graal/compiler` directory:
33
+
Change to the `graal/compiler` directory:
63
34
```bash
64
35
$ cd graal/compiler
65
36
```
66
37
67
38
Changing to the `graal/compiler` directory informs mx that the focus of development (called the _primary suite_) is the GraalVM compiler.
68
39
All subsequent mx commands should be executed from this directory.
69
40
70
-
Here's the recipe for building and running the GraalVM compiler:
41
+
Here's the recipe for building the VM and running a simple app with it:
71
42
72
43
```bash
73
44
$ mx build
74
-
$ mx vm
45
+
$ mx vm -Djdk.graal.ShowConfiguration=info ../compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/test/CountUppercase.java
75
46
```
76
47
77
-
When running `mx vm`, the GraalVM compiler is used as the top tier JIT compiler by default. To revert to using C2 instead,
78
-
add the `-XX:-UseJVMCICompiler` option to the command line.
79
-
To disable use of the GraalVM compiler altogether (i.e. for hosted compilations as well), use `-XX:-EnableJVMCI`.
80
-
81
-
### Windows Specifics
82
-
83
-
When applying above steps on Windows, replace `export` with `set`.
48
+
When running `mx vm`, the GraalVM compiler is used as the top tier JIT compiler by default.
84
49
85
50
## IDE Configuration
86
51
@@ -93,19 +58,24 @@ $ mx ideinit
93
58
This will generate Eclipse, IntelliJ, and NetBeans project configurations.
94
59
Further information on how to import these project configurations into individual IDEs can be found on the [IDEs](docs/IDEs.md) page.
95
60
96
-
The [Ideal Graph Visualizer](https://www.graalvm.org/advanced-tools/#ideal-graph-visualizer)(IGV) is very useful in terms of visualizing the compiler's intermediate representation (IR).
97
-
IGV is available on [OTN](https://www.oracle.com/downloads/graalvm-downloads.html).
61
+
## IGV
62
+
63
+
The [Ideal Graph Visualizer](https://www.graalvm.org/latest/tools/igv/)(IGV) is very useful in terms of visualizing the compiler's intermediate representation (IR).
98
64
You can get a quick insight into this tool by running the commands below.
99
65
The first command launches the tool and the second runs one of the unit tests included in the code base with extra options to dump the compiler IR for all methods compiled.
100
66
You should wait for the GUI to appear before running the second command.
If you added `-XX:+UseJVMCICompiler` as described above, you will see IR for compilations requested by the VM itself in addition to compilations requested by the unit test.
108
-
The former are those with a prefix in the UI denoting the compiler thread and id of the compilation (e.g., `JVMCI CompilerThread0:390`).
73
+
> Launching IGV may fail if the `JAVA_HOME` is not compatible with the version of the NetBeans
74
+
> platform on which IGV is based. Running `mx help igv` will provide more help in this context
75
+
> and you can use `mx fetch-jdk` to get a compatible JDK.
76
+
77
+
If you add `-XX:+UseJVMCICompiler` (after `unittest`), you will see IR for compilations requested by the VM itself in addition to compilations requested by the unit test.
78
+
The former are those with a prefix in the UI denoting the id of the compilation.
109
79
110
80
Further information can be found on the [Debugging](docs/Debugging.md) page.
111
81
@@ -126,8 +96,8 @@ to only be compiled by C1 (i.e., `-Djdk.graal.CompileGraalWithC1Only=true`) but
126
96
of slower compilation speed.
127
97
128
98
To address these issues, the GraalVM compiler can be deployed as a native shared library. The shared
129
-
library is a native image produced using [SubstrateVM](../substratevm/README.md). In this mode,
130
-
the GraalVM compiler uses memory separate from the HotSpot heap and it runs compiled
99
+
library is a native image produced using [Native Image](../substratevm/README.md). In this mode,
100
+
the compiler uses memory separate from the HotSpot heap and it runs compiled
131
101
from the start. That is, it has execution properties similar to other native HotSpot
132
102
compilers such as C1 and C2.
133
103
@@ -137,42 +107,30 @@ To build libgraal:
137
107
$ cd graal/vm
138
108
$ mx --env libgraal build
139
109
```
140
-
The newly built GraalVM image containing libgraal is available at:
110
+
The newly built GraalVM image containing libgraal is shown by:
141
111
```bash
142
112
$ mx --env libgraal graalvm-home
143
113
```
144
-
or following this symlink:
114
+
or by following this symlink:
145
115
```bash
146
116
$ ./latest_graalvm_home
147
117
```
148
-
For more information about building GraalVM images, see the [README file of the vm suite](../vm/README.md).
118
+
119
+
For more information about building Native Images, see the [README file of the vm suite](../vm/README.md).
149
120
150
121
Without leaving the `graal/vm` directory, you can now run libgraal as follows:
0 commit comments