Skip to content

Commit

Permalink
renaming: Graal compiler -> GraalVM compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
dougxc committed Apr 23, 2019
1 parent 97567eb commit 8cfa7ac
Show file tree
Hide file tree
Showing 29 changed files with 111 additions and 131 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The GraalVM main source repository includes the following components:

* [GraalVM SDK](sdk/README.md) contains long term supported APIs of GraalVM.

* [Graal compiler](compiler/README.md) written in Java that supports both dynamic and static compilation and can integrate with
* [GraalVM compiler](compiler/README.md) written in Java that supports both dynamic and static compilation and can integrate with
the Java HotSpot VM or run standalone.

* [Truffle](truffle/README.md) language implementation framework for creating languages and instrumentations for GraalVM.
Expand All @@ -39,8 +39,8 @@ Please report security vulnerabilities not via GitHub issues or the public maili

## Related Repositories

GraalVM allows running of following languages which are being developed and tested in related repositories with GraalVM core to run on top of it using Truffle and Graal compiler. These are:
* [Graal JavaScript](https://github.com/graalvm/graaljs) - JavaScript (ECMAScript 2019 compatible) and Node.js 10.15.2
GraalVM allows running of following languages which are being developed and tested in related repositories with GraalVM core to run on top of it using Truffle and the GraalVM compiler. These are:
* [GraalJS](https://github.com/graalvm/graaljs) - JavaScript (ECMAScript 2019 compatible) and Node.js 10.15.2
* [FastR](https://github.com/oracle/fastr) - R Language 3.5.1
* [GraalPython](https://github.com/graalvm/graalpython) - Python 3.7
* [TruffleRuby](https://github.com/oracle/truffleruby/) - Ruby Programming Language 2.6.2
Expand All @@ -50,10 +50,10 @@ GraalVM allows running of following languages which are being developed and test
## License

Each GraalVM component is licensed:
* [Truffle](/truffle/) and its dependency [GraalVM SDK](/sdk/) are licensed under the [Universal Permissive License](truffle/LICENSE.md).
* [Truffle Framework](/truffle/) and its dependency [GraalVM SDK](/sdk/) are licensed under the [Universal Permissive License](truffle/LICENSE.md).
* [Tools](/tools/) project is licensed under the [GPL 2 with Classpath exception](tools/LICENSE.GPL.md).
* [TRegex](/regex/) project is licensed under the [GPL 2 with Classpath exception](regex/LICENSE.GPL.md).
* The [Graal compiler](/compiler/) is licensed under the [GPL 2 with Classpath exception](compiler/LICENSE.md).
* [GraalVM compiler](/compiler/) is licensed under the [GPL 2 with Classpath exception](compiler/LICENSE.md).
* [Substrate VM](/substratevm/) is licensed under the [GPL 2 with Classpath exception](substratevm/LICENSE.md).
* [Sulong](/sulong/) is licensed under [3-clause BSD](sulong/LICENSE).
* [VM](/vm/) is licensed under the [GPL 2 with Classpath exception](vm/LICENSE_GRAALVM_CE).
72 changes: 37 additions & 35 deletions compiler/README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
Graal is a dynamic compiler written in Java that integrates with the HotSpot JVM. It has a focus on high performance and extensibility.
In addition, it provides optimized performance for [Truffle](https://github.com/graalvm/graal/tree/master/truffle)-based languages running on the JVM.
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.
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.
For brevity, the GraalVM compiler is often referred to as "the compiler" below.

## Setup

Working with Graal will mean cloning more than one repository and so it's
Working with the GraalVM compiler will mean cloning more than one repository and so it's
recommended to create and use a separate directory:

```
mkdir graal
cd graal
```

## Building Graal
## Building the GraalVM compiler

To simplify Graal development, a separate Python tool called [mx](https://github.com/graalvm/mx) has been co-developed.
To simplify development, a separate Python tool called [mx](https://github.com/graalvm/mx) has been co-developed.
This tool must be downloaded and put onto your PATH:

```
git clone https://github.com/graalvm/mx.git
export PATH=$PWD/mx:$PATH
```

Graal depends on a JDK that supports a compatible version of JVMCI ([JVM Compiler Interface](https://bugs.openjdk.java.net/browse/JDK-8062493)).
The compiler depends on a JDK that supports a compatible version of JVMCI ([JVM Compiler Interface](https://bugs.openjdk.java.net/browse/JDK-8062493)).
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.
To develop Graal you need either a JVMCI-enabled JDK 8 (download from [OTN](http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html) or [build](#building-jvmci-jdk8) yourself)
or JDK 11 (build 20 or later).
You need either a JVMCI-enabled JDK 8 (download from [OTN](http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html) or [build](#building-jvmci-jdk8) yourself)
or JDK 11.

Most Graal sources are compliant with Java 8. Some sources use API specific to JDK 8 or only introduced in JDK 9.
Most compiler sources are compliant with Java 8. Some sources use API specific to JDK 8 or only introduced in JDK 9.
These sources are in [versioned projects](https://github.com/graalvm/mx#versioning-sources-for-different-jdk-releases).
If you don't have a JDK that satisfies the requirement of a versioned project, the project is ignored by mx.

If you only want to develop Graal for a single JDK version, you only need to define `JAVA_HOME`. For example:
If you want to develop on a single JDK version, you only need to define `JAVA_HOME`. For example:
```
export JAVA_HOME=/usr/lib/jvm/labsjdk1.8.0_172-jvmci-0.46
export JAVA_HOME=/usr/lib/jvm/labsjdk1.8.0_202-jvmci-0.59
```
or:
```
export JAVA_HOME=/usr/lib/jvm/jdk-11
```

If you want to ensure your changes will pass both JDK 8 and JDK 11 gates, you can specify the secondary JDK(s) in `EXTRA_JAVA_HOMES`.
For example, to develop Graal for JDK 8 while ensuring `mx build` still works with the JDK 11 specific sources:
For example, to develop for JDK 8 while ensuring `mx build` still works with the JDK 11 specific sources:

```
export JAVA_HOME=/usr/lib/jvm/labsjdk1.8.0_172-jvmci-0.46
Expand All @@ -59,19 +60,19 @@ Now change to the `graal/compiler` directory:
cd graal/compiler
```

Changing to the `graal/compiler` directory informs mx that the focus of development (called the _primary suite_) is Graal.
Changing to the `graal/compiler` directory informs mx that the focus of development (called the _primary suite_) is the GraalVM compiler.
All subsequent mx commands should be executed from this directory.

Here's the recipe for building and running Graal:
Here's the recipe for building and running the GraalVM compiler:

```
mx build
mx vm
```

By default, Graal is only used for hosted compilation (i.e., the VM still uses C2 for compilation).
To make the VM use Graal as the top tier JIT compiler, add the `-XX:+UseJVMCICompiler` option to the command line.
To disable use of Graal altogether, use `-XX:-EnableJVMCI`.
By default, the GraalVM compiler is only used for hosted compilation (i.e., the VM still uses C2 for compilation).
To make the VM use the GraalVM compiler as the top tier JIT compiler, add the `-XX:+UseJVMCICompiler` option to the command line.
To disable use of the GraalVM compiler altogether, use `-XX:-EnableJVMCI`.

### Windows Specifics

Expand All @@ -88,13 +89,14 @@ mx ideinit
This will generate Eclipse, IntelliJ, and NetBeans project configurations.
Further information on how to import these project configurations into individual IDEs can be found on the [IDEs](docs/IDEs.md) page.

The Graal code base includes the [Ideal Graph Visualizer](http://ssw.jku.at/General/Staff/TW/igv.html) which is very useful in terms of visualizing Graal's intermediate representation (IR).
The [Ideal Graph Visualizer](https://www.graalvm.org/docs/reference-manual/tools/#ideal-graph-visualizer)(IGV) is very useful in terms of visualizing the compiler's intermediate representation (IR).
IGV is distributed as part of [GraalVM EE](https://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html).
You can get a quick insight into this tool by running the commands below.
The first command launches the tool and the second runs one of the unit tests included in the Graal code base with extra options to make Graal dump the IR for all methods it compiles.
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.
You should wait for the GUI to appear before running the second command.

```
mx igv &
$GRAALVM_EE_HOME/bin/idealgraphvisualizer &
mx unittest -Dgraal.Dump BC_athrow0
```

Expand All @@ -105,33 +107,33 @@ Further information can be found on the [Debugging](docs/Debugging.md) page.

## libgraal

Building Graal as described above enables it to be used in HotSpot as Java code
called from the VM. In this mode, Graal is executed in the same way as any
Building the GraalVM compiler as described above means it is executed in the same way as any
other Java code in the VM; it allocates in the HotSpot heap and it starts execution
in the interpreter with hot parts being subsequently JIT compiled.
The advantage of this mode is that Graal can be debugged with a Java debugger.
The advantage of this mode is that it can be debugged with a Java debugger.

However, it has some disadvantages. Firstly, since Graal uses the object heap, it can
However, it has some disadvantages. Firstly, since it uses the object heap, it can
reduce application object locality and increase GC pause times. Additionally, it can
complicate fine tuning options such as `-Xmx` and `-Xms` which now need to take the
heap usage of Graal needs to be taken into account. Secondly, Graal will initially be executed
heap usage of the compiler into account. Secondly, the compiler will initially be executed
in the interpreter and only get faster over time as its hot methods are JIT
compiled. This is mitigated to some degree by forcing Graal (and JVMCI)
to only be compiled by C1 but this comes at the cost of lower peak performance for Graal.
compiled. This is mitigated to some degree by forcing the GraalVM compiler
to only be compiled by C1 (i.e., `-Dgraal.CompileGraalWithC1Only=true`) but this comes at the cost
of slower compilation speed.

To address these issues, Graal can be deployed as a native shared library. The shared
library is produced using [SubstrateVM](../substratevm/README.md) to ahead-of-time compile Graal. In this mode,
Graal uses memory separate from the HotSpot heap and it runs compiled
To address these issues, the GraalVM compiler can be deployed as a native shared library. The shared
library is a native image produced using [SubstrateVM](../substratevm/README.md). In this mode,
the GraalVM compiler uses memory separate from the HotSpot heap and it runs compiled
from the start. That is, it has execution properties similar to other native HotSpot
compilers such as C1 and C2.

To build a GraalVM image with libgraal:
To build libgraal:

```
cd graal/vm
mx --env libgraal build
```
The newly built GraalVM image is available at:
The newly built GraalVM image containing libgraal is available at:
```
mx --env libgraal graalvm-home
```
Expand Down Expand Up @@ -161,7 +163,7 @@ Without leaving the `graal/vm` directory, you can now run libgraal as follows:
## Publications and Presentations
For video tutorials, presentations and publications on Graal visit the [Publications](../docs/Publications.md) page.
For video tutorials, presentations and publications on the GraalVM compiiler visit the [Publications](../docs/Publications.md) page.
## Building JVMCI JDK 8
Expand All @@ -178,7 +180,7 @@ export JAVA_HOME=$(mx --java-home /path/to/jdk8 jdkhome)
You need to use the same JDK the [OTN](http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html) downloads are based on as the argument to `--java-home` in the above commands.
The build step above should work on all [supported JDK 8 build platforms](https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms).
It should also work on other platforms (such as Oracle Linux, CentOS and Fedora as described [here](http://mail.openjdk.java.net/pipermail/graal-dev/2015-December/004050.html)).
If you run into build problems, send a message to the [Graal mailing list](http://mail.openjdk.java.net/mailman/listinfo/graal-dev).
If you run into build problems, send a message to http://mail.openjdk.java.net/mailman/listinfo/graal-dev.
### Windows Specifics
Expand All @@ -200,4 +202,4 @@ You will also need an *MSVC 2010 SP1* compiler. The following tool chain is reco
## License
The Graal compiler is licensed under the [GPL 2](LICENSE.md).
The GraalVM compiler is licensed under the [GPL 2](LICENSE.md).
20 changes: 10 additions & 10 deletions compiler/docs/Debugging.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

This pages covers the various mechanisms currently available for debugging Graal.
This pages covers the various mechanisms currently available for debugging the GraalVM compiler.

## IDE Support

All the parts of Graal written in Java can be debugged with a standard Java debugger.
All the parts of the GraalVM compiler (henceforth just "compiler") written in Java can be debugged with a standard Java debugger.
While debugging with Eclipse is described here, it should not be too hard to adapt these instructions for another debugger.

The `mx eclipseinit` command not only creates Eclipse project configurations but also creates an
Eclipse launch configuration (in
`mx.compiler/eclipse-launches/compiler-attach-localhost-8000.launch`) that can be used to debug all
Graal code running in the VM. This launch configuration requires you to start the VM with the `-d`
compiler code running in the VM. This launch configuration requires you to start the VM with the `-d`
global option which puts the VM into a state waiting for a remote debugger to attach to port `8000`:

```
Expand All @@ -34,7 +34,7 @@ At this point you can set breakpoints and perform all other normal Java debuggin

## Logging

In addition to IDE debugging, Graal includes support for *printf* style debugging.
In addition to IDE debugging, there is support for *printf* style debugging.
The simplest is to place temporary usages of `System.out` where ever you need them.

For more permanent logging statements, use the `log(...)` methods in
Expand Down Expand Up @@ -66,16 +66,16 @@ taken when such objects can be exposed to multiple threads. There are assertion
guarding against use in a thread different from the one in which it was instantiated.


## JVMCI and Graal specific options
## JVMCI and compiler specific options

JVMCI and Graal options are specified by the `jvmci.*` and `graal.*` system properties
JVMCI and GraalVM compiler options are specified by the `jvmci.*` and `graal.*` system properties
respectively. These must be specified on the JVM command line. Modifications to these properties by
application code are not seen by JVMCI and Graal. A listing of all supported properties can be
application code are not seen by JVMCI and the compiler. A listing of all supported properties can be
obtained with `-XX:+JVMCIPrintProperties`.

## Metrics

Graal supports metrics in the form of counters, timers and memory trackers.
The compiler supports metrics in the form of counters, timers and memory trackers.
Each metric has a unique name. Metrics are collected per-compilation.
At shutdown, they are aggregated across all compilations and reported to the console.
This ouput can be redirected to a file via the `-Dgraal.AggregatedMetricsFile` option.
Expand Down Expand Up @@ -210,7 +210,7 @@ since metric registration is lazy. For example, to see all the metrics availabl

## Dumping

In addition to logging, Graal provides support for generating (or dumping) more detailed
In addition to logging, there is support for generating (or dumping) more detailed
visualizations of certain compiler data structures. Currently, there is support for dumping:

* HIR graphs (i.e., instances of
Expand Down Expand Up @@ -256,7 +256,7 @@ dumps/1497910458736/HotSpotCompilation-539[org.graalvm.compiler.graph.Node.updat
dumps/1497910458736/HotSpotCompilation-539[org.graalvm.compiler.graph.Node.updateUsages(Node, Node)].cfg
```

As you become familiar with the scope names used in Graal, you can refine the `-Dgraal.Dump` option
As you become familiar with the scope names used in the compiler, you can refine the `-Dgraal.Dump` option
to limit the amount of dump output generated. For example, the `"CodeGen"` and `"CodeInstall"`
scopes are active during code generation and installation respectively. To see the machine code (in
the C1Visualizer) produced during these scopes:
Expand Down
22 changes: 0 additions & 22 deletions compiler/docs/Examples.md

This file was deleted.

Loading

0 comments on commit 8cfa7ac

Please sign in to comment.