Skip to content

Commit 14c1b1c

Browse files
Update docs/hacking.md for standalone changes
1 parent cd41dd3 commit 14c1b1c

File tree

1 file changed

+33
-17
lines changed

1 file changed

+33
-17
lines changed

espresso/docs/hacking.md

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,55 @@
22

33
## Building
44

5-
Set your (JVMCI-enabled) JDK via `mx` argument e.g. `mx --java-home /path/to/java/home ...` or via `export JAVA_HOME=/path/to/java/home`. Or (easiest) run `mx fetch-jdk` to download one.
5+
### Using a pre-built GraalVM
6+
7+
The simplest way to build espresso is to use a pre-built GraalVM.
8+
9+
Download and unpack the latest GraalVM [release](https://www.graalvm.org/downloads/) or [ea build](https://github.com/graalvm/oracle-graalvm-ea-builds/releases).
610

7-
`mx build`-ing Espresso creates a GraalVM with Espresso included. You can find out where it is by running `mx graalvm-home`.
11+
Set the `JAVA_HOME` environment variable to the extracted result. This will be used during the build and as a host JDK.
812

9-
To build the default configuration (interpreter-only), on the `espresso` repository:
13+
Espresso is only a JVM and it needs a JDK to use as a guest. Set the `ESPRESSO_JAVA_HOME` to a JDK to be used for the guest.
14+
15+
To build, run:
1016

1117
```bash
1218
$ mx build
1319
```
1420

15-
Other configurations are provided:
21+
### Using native-image from the graal repository
22+
23+
It is also possible to build using native-image built from sources from the current graal repository.
1624

25+
Set your (JVMCI-enabled) JDK via `mx` argument e.g. `mx --java-home /path/to/java/home ...` or via `export JAVA_HOME=/path/to/java/home`. Or (easiest) run `mx fetch-jdk` to download one.
26+
27+
Set the `ESPRESSO_JAVA_HOME` to a JDK to be used for the guest.
28+
29+
Build using one of the provided configuration:
1730
```bash
1831
$ mx --env jvm build # GraalVM CE + Espresso jars (interpreter only)
1932
$ mx --env jvm-ce build # GraalVM CE + Espresso jars (JIT)
2033
$ mx --env native-ce build # GraalVM CE + Espresso native (JIT)
34+
```
35+
36+
`mx build`-ing Espresso creates "espresso standalones" which are JDK-like directories.
2137

22-
# Use the same --env argument used to build.
23-
$ export ESPRESSO=`mx --env native-ce graalvm-home`/bin/espresso
38+
If you are only trying to build a specific one it's possible to specify it while building:
39+
```bash
40+
$ mx --env native-ce build --targets=ESPRESSO_NATIVE_STANDALONE
2441
```
2542

26-
Configuration files: `mx.espresso/{jvm,jvm-ce,native-ce}` and `mx.espresso/native-image.properties`
43+
Configuration files: `mx.espresso/{jvm,jvm-ce,native-ce}`
2744

2845
## Running Espresso
2946

30-
`mx espresso` runs Espresso (from jars or native) from within a GraalVM. It mimics the `java` (8|11) command. Bare `mx espresso` runs Espresso on interpreter-only mode.
47+
You can find out where the espresso standalones are by running `mx path --output ...`:
48+
```bash
49+
$ mx path --output ESPRESSO_NATIVE_STANDALONE
50+
$ mx path --output ESPRESSO_JVM_STANDALONE
51+
```
52+
53+
`mx espresso` runs Espresso from a standalone (jvm or native). It mimics the `java` command.
3154

3255
```bash
3356
$ mx --env jvm-ce build # Always build first
@@ -45,7 +68,7 @@ The `mx espresso` launcher adds some overhead, to execute Espresso native image
4568

4669
```bash
4770
$ mx --env native-ce build # Always build first
48-
$ export ESPRESSO=`mx --env native-ce graalvm-home`/bin/espresso
71+
$ export ESPRESSO=`mx path --output ESPRESSO_NATIVE_STANDALONE`/bin/java
4972
$ time $ESPRESSO -cp my.jar HelloWorld
5073
```
5174

@@ -71,17 +94,10 @@ $ mx build
7194
$ mx -d espresso-embedded -cp mxbuild/dists/jdk1.8/espresso-playground.jar com.oracle.truffle.espresso.playground.HelloWorld
7295
```
7396

74-
It can also run on a GraalVM with JIT compilation:
75-
76-
```bash
77-
$ mx build
78-
$ mx --dy /compiler espresso-embedded -cp my.jar HelloWorld
79-
```
80-
8197
## Dumping IGV graphs
8298

8399
```bash
84-
$ mx -v --dy /compiler -J"-Djdk.graal.Dump=:4 -Djdk.graal.TraceTruffleCompilation=true -Djdk.graal.TruffleBackgroundCompilation=false" espresso-embedded -cp mxbuild/dists/jdk1.8/espresso-playground.jar com.oracle.truffle.espresso.playground.TestMain
100+
$ mx --env jvm-ce espresso --vm.Djdk.graal.Dump=Truffle:2 --vm.Dpolyglot.engine.TraceCompilation=true -cp mxbuild/dists/jdk1.8/espresso-playground.jar com.oracle.truffle.espresso.playground.TestMain
85101
```
86102

87103
## Running Espresso cross-versions

0 commit comments

Comments
 (0)