Skip to content

Commit 968936b

Browse files
committed
[GR-15995] Do not add Graal at runtime, and instead require including it at build time.
PullRequest: truffleruby/857
2 parents 7dc9597 + 14f7836 commit 968936b

File tree

18 files changed

+57
-201
lines changed

18 files changed

+57
-201
lines changed

bench/optcarrot/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The code is imported from revision `898783836dfcec04d25a8e7d4b1ce3ce3bbcebdd`.
99

1010
The emulator can be run with the SDL2 GUI with:
1111
```
12-
$ jt install graal
12+
$ jt build --graal
1313
14-
$ jt ruby --graal bench/optcarrot/bin/optcarrot --sdl2 --audio=none bench/optcarrot/examples/Lan_Master.nes
14+
$ jt ruby bench/optcarrot/bin/optcarrot --sdl2 --audio=none bench/optcarrot/examples/Lan_Master.nes
1515
```

ci.jsonnet

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,9 @@ local part_definitions = {
136136
graal: {
137137
core: {
138138
is_after+:: ["$.use.build"],
139-
setup+: [
140-
["cd", "../graal/compiler"],
141-
["mx", "build"],
142-
["cd", "../../main"],
143-
],
139+
setup+: jt(["build", "--graal"]),
144140

145141
environment+: {
146-
GRAAL_HOME: "../graal/compiler",
147142
HOST_VM: "server",
148143
HOST_VM_CONFIG: "graal-core",
149144
},
@@ -153,7 +148,6 @@ local part_definitions = {
153148
environment+: {
154149
HOST_VM: "server",
155150
HOST_VM_CONFIG: "default",
156-
MX_NO_GRAAL: "true",
157151
},
158152
},
159153

@@ -170,14 +164,9 @@ local part_definitions = {
170164
["git", "-C", repo, "checkout", find_commit_importing_truffle],
171165
],
172166

173-
setup+: self.clone + [
174-
["cd", "../graal-enterprise/graal-enterprise"],
175-
["mx", "build"],
176-
["cd", "../../main"],
177-
],
167+
setup+: self.clone + jt(["build", "--dy", "/graal-enterprise"]),
178168

179169
environment+: {
180-
GRAAL_HOME: "$BUILD_DIR/graal-enterprise/graal-enterprise",
181170
HOST_VM: "server",
182171
HOST_VM_CONFIG: "graal-enterprise",
183172
},
@@ -201,7 +190,6 @@ local part_definitions = {
201190

202191
environment+: {
203192
HOST_VM_CONFIG: "graal-core",
204-
GRAAL_HOME: "$BUILD_DIR/graal/compiler",
205193
VM_SUITE_HOME: "$BUILD_DIR/graal/vm",
206194
},
207195
},
@@ -215,7 +203,6 @@ local part_definitions = {
215203

216204
environment+: {
217205
HOST_VM_CONFIG: "graal-enterprise",
218-
GRAAL_HOME: "$BUILD_DIR/graal-enterprise/graal-enterprise",
219206
VM_SUITE_HOME: "$BUILD_DIR/graal-enterprise/vm-enterprise",
220207
},
221208
},
@@ -441,9 +428,9 @@ local part_definitions = {
441428
compiler_metrics: {
442429
# Run all metrics benchmarks: hello and compile-mandelbrot
443430
benchmarks+:: [
444-
["allocation", "--", "--graal"],
445-
["minheap", "--", "--graal"],
446-
["time", "--", "--graal"],
431+
"allocation",
432+
"minheap",
433+
"time",
447434
]
448435
},
449436

doc/contributor/benchmarking.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## Benchmarking with the GraalVM Compiler
44

5+
First build TruffleRuby and include the GraalVM Compiler:
6+
7+
```bash
8+
$ jt build --graal
9+
```
10+
11+
Then run the benchmark, for instance:
12+
513
```bash
614
$ jt benchmark bench/classic/mandelbrot.rb --simple
715
```
@@ -11,10 +19,16 @@ for the first few iterations).
1119

1220
# Benchmarking without the GraalVM Compiler
1321

14-
You can turn off the GraalVM Compiler if you want using `--no-graal`.
22+
You can turn off the GraalVM Compiler if you want, by not including it in the GraalVM build:
1523

1624
```bash
17-
$ jt benchmark --no-graal bench/classic/mandelbrot.rb --simple
25+
$ jt build
26+
```
27+
28+
It's the same command to run the benchmark, for instance:
29+
30+
```bash
31+
$ jt benchmark bench/classic/mandelbrot.rb --simple
1832
```
1933

2034
You can benchmark an entirely different implementation using the

doc/contributor/building-graal.md

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,16 @@ when developing TruffleRuby, or possibly to modify them, or to use developer
66
tools that come with Graal such as the Ideal Graph Visualizer, then you should
77
install Graal locally.
88

9-
## Installing Graal with jt
9+
## Building Graal with jt
1010

11-
Our workflow tool can install Graal automatically under the directory
12-
`../graal/compiler` with:
11+
Our workflow tool can build Graal automatically with:
1312

1413
```bash
15-
$ jt install graal
14+
$ jt build --graal
1615
```
1716

18-
You can then use `jt` to run TruffleRuby with Graal.
17+
You can then use `jt` as normal to run TruffleRuby with Graal.
1918

2019
```bash
21-
$ jt ruby --graal ...
22-
```
23-
24-
## Building Graal manually
25-
26-
If you want to build the GraalVM Compiler by yourself, follow the instructions
27-
in the Graal repository.
28-
29-
https://github.com/oracle/graal
30-
31-
You can then set the `GRAAL_HOME` environment variable to the location of the
32-
`compiler` directory inside the `graal` repository and use `jt` to run
33-
TruffleRuby.
34-
35-
```bash
36-
$ GRAAL_HOME=.../graal/compiler jt ruby --graal ...
20+
$ jt ruby ...
3721
```

doc/contributor/workflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ Ruby command line options and arguments can also be set in `RUBYOPT`.
140140

141141
## Running with Graal
142142

143-
See the document on [build graal](building-graal.md), and then run `jt ruby`
144-
with the `--graal` option.
143+
See the document on [building graal](building-graal.md), and then run `jt ruby`
144+
as normal.
145145

146146
We have flags in `jt` to set some options, such as `--trace` for
147147
`--vm.Dgraal.TraceTruffleCompilation=true` and `--igv` for

doc/samples/can-we-fold-yet.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010

1111
require 'readline'
1212

13-
unless TruffleRuby.jit?
14-
puts 'You need the GraalVM Compiler to run this'
15-
exit
16-
end
13+
abort 'You need the GraalVM Compiler to run this' unless TruffleRuby.jit?
1714

1815
puts 'Can Truffle constant fold yet?'
1916

mx.truffleruby/mx_truffleruby_benchmark.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ def filterLines(self, lines):
269269

270270
def runBenchmark(self, benchmark, bmSuiteArgs):
271271
arguments = ['benchmark']
272-
if 'MX_NO_GRAAL' in os.environ:
273-
arguments.extend(['--no-graal'])
274272
arguments.extend(['--simple', '--elapsed', '--iterations'])
275273
arguments.extend(['--time', str(self.time())])
276274
if ':' in benchmark:
@@ -586,8 +584,8 @@ def name(self):
586584

587585
def runBenchmark(self, benchmark, bmSuiteArgs):
588586
arguments = ['ruby']
589-
if 'MX_NO_GRAAL' not in os.environ and not bmSuiteArgs:
590-
arguments.extend(['--graal', '--vm.Dgraal.TruffleCompilationExceptionsAreFatal=true'])
587+
if not bmSuiteArgs:
588+
arguments.extend(['--vm.Dgraal.TruffleCompilationExceptionsAreFatal=true'])
591589
arguments.extend(['bench/servers/' + benchmark + '.rb'])
592590

593591
server = BackgroundJT(arguments + bmSuiteArgs)

test/truffle/compiler/can-we-fold-yet.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
source test/truffle/common.sh.inc
44

5-
jt ruby --graal --vm.Dgraal.TruffleIterativePartialEscape=true doc/samples/can-we-fold-yet.rb < test/truffle/compiler/can-we-fold-yet/input.txt > actual.txt
5+
jt ruby --vm.Dgraal.TruffleIterativePartialEscape=true doc/samples/can-we-fold-yet.rb < test/truffle/compiler/can-we-fold-yet/input.txt > actual.txt
66

77
if ! cmp test/truffle/compiler/can-we-fold-yet/expected.txt actual.txt
88
then

test/truffle/compiler/compile-immediately.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
source test/truffle/common.sh.inc
44

5-
jt ruby --graal --stress --trace -e "puts 'hello'"
5+
jt ruby --stress --trace -e "abort 'not running the GraalVM Compiler' unless TruffleRuby.jit?; puts 'hello'"

test/truffle/compiler/osr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
source test/truffle/common.sh.inc
44

5-
jt ruby --graal --vm.Dgraal.TruffleCompilationExceptionsAreFatal=true test/truffle/compiler/osr/osr.rb
5+
jt ruby --vm.Dgraal.TruffleCompilationExceptionsAreFatal=true test/truffle/compiler/osr/osr.rb

0 commit comments

Comments
 (0)