Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/GR-15886
Browse files Browse the repository at this point in the history
  • Loading branch information
dbalek committed May 22, 2019
2 parents 065f3e2 + 6a01cae commit 628038c
Show file tree
Hide file tree
Showing 408 changed files with 7,846 additions and 5,379 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jdk:

env:
global:
- JVMCI_VERSION="jvmci-0.59"
- JDK8_UPDATE_VERSION="202"
- JVMCI_VERSION="jvmci-20-b01"
- JDK8_UPDATE_VERSION="212"

matrix:
include:
Expand All @@ -37,7 +37,7 @@ matrix:
- clang-format-3.8
- libc++1
- libc++-dev
- env: JDK="jdk8" GATE="build,sulong" PRIMARY="vm" DYNAMIC_IMPORTS="/sulong,/substratevm" LLVM_VERSION="6.0" DISABLE_POLYGLOT=true DISABLE_LIBPOLYGLOT=true NATIVE_IMAGE_TESTING=true
- env: JDK="jdk8" GATE="build,sulong" PRIMARY="vm" DYNAMIC_IMPORTS="/sulong,/substratevm" LLVM_VERSION="6.0" DISABLE_POLYGLOT=true DISABLE_LIBPOLYGLOT=true
addons:
apt:
sources:
Expand Down
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).
2 changes: 1 addition & 1 deletion ci_includes/publish-javadoc.hocon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Publish Javadoc of graal components post-merge

builds += [
${linux-amd64} ${labsjdk8} {
${linux-amd64} ${oraclejdk8} {
timelimit : "30:00",
run : [
[cd, "./sdk"],
Expand Down
18 changes: 9 additions & 9 deletions common.hocon
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# overlay version
overlay = 92cc4cf61ccb3ffc91bea53450b8a73222107f8e
overlay = 24a9cd249544a2c8b61e225aa1f02c85db569fc4

# oraclejdk* are released OracleJDK binaries
# labsjdk* are JDKs based on OracleJDK binaries
# oraclejdk* are JDKs based on OracleJDK binaries
# openjdk8 JDKs on Linux are built by Oracle Labs
# openjdk8 JDKs on macOS are based on AdoptOpenJDK binaries
jdks: {
labsjdk8: {name : labsjdk, version : "8u202-jvmci-0.59", platformspecific: true}
openjdk8: {name : openjdk, version : "8u202-jvmci-0.59", platformspecific: true}
labsjdk8Debug: {name : labsjdk, version : "8u202-jvmci-0.59-fastdebug", platformspecific: true}
oraclejdk11: {name : oraclejdk, version : "11+28", platformspecific: true}
openjdk11: {name : openjdk, version : "11+28", platformspecific: true}
oraclejdk8: {name : oraclejdk, version : "8u212-jvmci-20-b01", platformspecific: true}
openjdk8: {name : openjdk, version : "8u212-jvmci-20-b01", platformspecific: true}
oraclejdk8Debug: {name : oraclejdk, version : "8u212-jvmci-20-b01-fastdebug", platformspecific: true}
oraclejdk11: {name : oraclejdk, version : "11.0.3+12", platformspecific: true}
openjdk11: {name : openjdk, version : "11.0.3+12", platformspecific: true}
}

# This must always point to HEAD in the master branch but can be used to point
Expand All @@ -27,8 +27,8 @@ download-hsdis : {
]
}

labsjdk8 : { downloads : { JAVA_HOME : ${jdks.labsjdk8}, EXTRA_JAVA_HOMES : { pathlist :[ ${jdks.oraclejdk11} ]} }}
labsjdk8Debug : { downloads : { JAVA_HOME : ${jdks.labsjdk8Debug}, EXTRA_JAVA_HOMES : { pathlist :[ ${jdks.oraclejdk11} ]} }}
oraclejdk8 : { downloads : { JAVA_HOME : ${jdks.oraclejdk8}, EXTRA_JAVA_HOMES : { pathlist :[ ${jdks.oraclejdk11} ]} }}
oraclejdk8Debug : { downloads : { JAVA_HOME : ${jdks.oraclejdk8Debug}, EXTRA_JAVA_HOMES : { pathlist :[ ${jdks.oraclejdk11} ]} }}

openjdk8 : { downloads : { JAVA_HOME : ${jdks.openjdk8} }}

Expand Down
79 changes: 41 additions & 38 deletions compiler/README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,56 @@
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).
A JVMCI-enabled JDK 8 can be downloaded from [OTN](https://www.oracle.com/technetwork/graalvm/downloads/index.html)
or [GitHub](https://github.com/graalvm/openjdk8-jvmci-builder/releases)
or you can [build](#building-jvmci-jdk8) it yourself.

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/oraclejdk1.8.0_212-jvmci-20-b01
```
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
export JAVA_HOME=/usr/lib/jvm/oraclejdk1.8.0_212-jvmci-20-b01
export EXTRA_JAVA_HOMES=/usr/lib/jvm/jdk-11
```
And on macOS:
```
export JAVA_HOME=/Library/Java/JavaVirtualMachines/labsjdk1.8.0_172-jvmci-0.46/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/oraclejdk1.8.0_212-jvmci-20-b01/Contents/Home
export EXTRA_JAVA_HOMES=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
```
If you omit `EXTRA_JAVA_HOMES` in the above examples, versioned projects depending on the specified JDK(s) will be ignored.
Expand All @@ -59,19 +61,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 +90,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 available on [OTN](https://www.oracle.com/technetwork/graalvm/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 +108,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 +164,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 @@ -175,10 +178,10 @@ mx --java-home /path/to/jdk8 unittest
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.
You need to use the same JDK the [OTN](https://www.oracle.com/technetwork/graalvm/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 +203,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).
Loading

0 comments on commit 628038c

Please sign in to comment.