Skip to content

Commit 7457499

Browse files
committed
Update terminology
1 parent 7b05138 commit 7457499

File tree

17 files changed

+212
-212
lines changed

17 files changed

+212
-212
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
![TruffleRuby logo](logo/png/truffleruby_logo_horizontal_medium.png)
22

3-
A high performance implementation of the Ruby programming language. Built on
4-
[GraalVM](http://graalvm.org/) by [Oracle Labs](https://labs.oracle.com).
3+
TruffleRuby is the [GraalVM](http://graalvm.org/) high-performance implementation
4+
of the [Ruby programming language](https://www.ruby-lang.org/en/) built by
5+
[Oracle Labs](https://labs.oracle.com).
56

67
## Getting started
78

@@ -61,7 +62,7 @@ TruffleRuby by default runs in the *native*
6162
configuration. In this configuration, TruffleRuby is ahead-of-time compiled to a
6263
standalone native executable. This means that you don't need a JVM installed on
6364
your system to use it. The advantage of the native configuration is that it
64-
[starts about as fast as MRI](doc/contributor/svm.md), it may use less memory,
65+
[starts about as fast as MRI](doc/contributor/native-image.md), it may use less memory,
6566
and it becomes fast in less time. The disadvantage of the native configuration
6667
is that you can't use Java tools like VisualVM, you can't use Java
6768
interoperability, and *peak performance may be lower than on the JVM*. The
@@ -89,7 +90,7 @@ At runtime you can tell if you are using the native configuration using
8990

9091
You won't encounter it when using TruffleRuby from the GraalVM, but there is
9192
also another configuration which is TruffleRuby running on the JVM but with the
92-
Graal compiler not available. This configuration will have much lower
93+
GraalVM Compiler not available. This configuration will have much lower
9394
performance and should normally only be used for development. `ruby --version`
9495
will mention `Interpreter` for this configuration.
9596

doc/contributor/benchmarking.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Benchmarking TruffleRuby
22

3-
## Benchmarking with Graal
3+
## Benchmarking with the GraalVM Compiler
44

55
```
66
$ jt benchmark bench/classic/mandelbrot.rb --simple
@@ -9,9 +9,9 @@ $ jt benchmark bench/classic/mandelbrot.rb --simple
99
Output is iterations per second, printed roughly every second (more frequently
1010
for the first few iterations).
1111

12-
# Benchmarking without Graal
12+
# Benchmarking without the GraalVM Compiler
1313

14-
You can turn off Graal if you want using `--no-graal`.
14+
You can turn off the GraalVM Compiler if you want using `--no-graal`.
1515

1616
```
1717
$ jt benchmark --no-graal bench/classic/mandelbrot.rb --simple

doc/contributor/building-graal.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# Building Graal
1+
# Building the GraalVM Compiler
22

3-
If you want to build Graal from scratch to test running with Graal when
4-
developing TruffleRuby, or possibly to modify Graal or Truffle, or to use
5-
developer tools that come with Graal such as the Ideal Graph Visualizer, then
6-
you should install Graal locally.
3+
If you want to build the Truffle Language Implementation Framework and the
4+
GraalVM Compiler and other dependencies from scratch to test running with them
5+
when developing TruffleRuby, or possibly to modify them, or to use developer
6+
tools that come with Graal such as the Ideal Graph Visualizer, then you should
7+
install Graal locally.
78

89
## Installing Graal with jt
910

@@ -22,10 +23,10 @@ $ jt ruby --graal ...
2223

2324
## Building Graal manually
2425

25-
If you want to build Graal by yourself, follow the instructions in the Graal
26-
repository.
26+
If you want to build the GraalVM Compiler by yourself, follow the instructions
27+
in the Graal repository.
2728

28-
https://github.com/graalvm/graal
29+
https://github.com/oracle/graal
2930

3031
You can then set the `GRAAL_HOME` environment variable to the location of the
3132
`compiler` directory inside the `graal` repository and use `jt` to run

doc/contributor/interop.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Truffle Interop
22

3-
TruffleRuby supports standard Truffle API interop messages. This document
4-
explains what it does when it receives them, how to get it to explicitly send
5-
them, how to get it to send them using more idiomatic Ruby, and how what
6-
messages it sends for normal Ruby operations on foreign objects.
3+
TruffleRuby supports the standard interop message system of the Truffle
4+
Language Implementation Framework. This document explains what it does when it
5+
receives them, how to get it to explicitly send them, how to get it to send
6+
them using more idiomatic Ruby, and how what messages it sends for normal Ruby
7+
operations on foreign objects.
78

89
This document only explains how TruffleRuby uses messages. The messages
910
themselves are explained in the

doc/contributor/native-image.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Using TruffleRuby with GraalVM Native Images
2+
3+
The GraalVM Native Image Generator is a closed-world analysis ahead-of-time
4+
compiler for Java, and an implementation of parts of a JVM.
5+
6+
We use Native Images to ahead-of-time compile TruffleRuby and the
7+
GraalVM Compiler to a single, statically-linked native binary
8+
executable, that has no dependency on a JVM, and does not link to any JVM
9+
libraries. The technique is more sophisticated than just appending a JAR as a
10+
resource in a copy of the JVM - only parts of the JVM which are needed are
11+
included and they are specialised for how TruffleRuby uses them. There is no
12+
Java bytecode - only compiled native machine code and compiler graphs for
13+
dynamic compilation.
14+
15+
Note that the GraalVM Native Image Generator is not an ahead-of time compiler
16+
for your Ruby program. It only ahead-of-time compiles the Java code that
17+
implements the TruffleRuby interpreter and the GraalVM Compiler.
18+
19+
The GraalVM Native Image Generator itself, like the GraalVM Compiler and
20+
TruffleRuby, is implemented in Java.
21+
22+
https://youtu.be/FJY96_6Y3a4?t=10023
23+
24+
More information can be found in Kevin Menard's
25+
[blog post](http://nirvdrum.com/2017/02/15/truffleruby-on-the-substrate-vm.html).
26+
27+
The TruffleRuby that is distributed in the
28+
[GraalVM](../user/installing-graalvm.md) by default uses a version compiled
29+
using the Native Image Generator - this is to prioritise fast start-up and
30+
warm-up time for shorter running commands and benchmarks.
31+
32+
```bash
33+
$ cd graalvm
34+
$ otool -L jre/bin/ruby
35+
jre/bin/ruby:
36+
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1348.28.0)
37+
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
38+
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
39+
40+
$ du -h jre/bin/ruby
41+
200M jre/bin/ruby
42+
```
43+
44+
The Native Image version of TruffleRuby has better startup performance and lower memory
45+
footprint than JRuby, Rubinius and TruffleRuby on the JVM, and similar or better
46+
startup performance than MRI.
47+
48+
| Implementation | Real Time (s) | Max RSS (MB) |
49+
| ------------------ | ------------: | -----------: |
50+
| TruffleRuby Native | 0.025 | 65 |
51+
| MRI 2.6.2 | 0.048 | 14 |
52+
| Rubinius 3.107 | 0.150 | 78 |
53+
| JRuby 9.2.7.0 | 1.357 | 160 |
54+
| TruffleRuby JVM | 1.787 | 456 |
55+
56+
Run on Linux with an Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz with a SSD.
57+
58+
```bash
59+
$ cd graalvm-ce-1.0.0-rc15
60+
$ bin/ruby -e 'puts "Hello"' # TruffleRuby on the SVM
61+
$ bin/ruby --jvm -e 'puts "Hello"' # TruffleRuby on the JVM
62+
63+
$ chruby ruby-2.6.2
64+
$ ruby -e 'puts "Hello"'
65+
66+
$ chruby rbx-3.107
67+
$ rbx -e 'puts "Hello"'
68+
69+
$ chruby jruby-9.2.7.0
70+
$ jruby -e 'puts "Hello"'
71+
```
72+
73+
The real time and the maximum resident set size are measured with a custom
74+
[C program](https://gist.github.com/eregon/cbf6c89451ecf815463c00aef9745837)
75+
as `time` cannot measure real time in milliseconds and max RSS.
76+
Each command is run 10 times and the average is reported.
77+
`clock_gettime(CLOCK_MONOTONIC)` is used to measure time and `getrusage()` to
78+
measure max RSS.
79+
80+
There is no need to do so, but you can actually also compile your own copy of
81+
the Native Image version of TruffleRuby using a tool distributed as part of GraalVM and
82+
the Java version of TruffleRuby from GraalVM.
83+
84+
```
85+
$ native-image -H:Name=native-ruby --language:ruby
86+
```
87+
88+
`native-ruby` is the output file name.
89+
90+
You can build a native build of TruffleRuby using the Native Image Tool from a
91+
source distribution using:
92+
93+
```
94+
$ jt build native
95+
```
96+
97+
The disadvantages of the Native Image version of TruffleRuby are:
98+
99+
* It has lower peak performance, as the GC is simpler and some optimisations
100+
such as compressed ordinary object pointers (OOPS) are not yet available.
101+
* You can't use Java interoperability.
102+
* You can't use standard Java tools like VisualVM.
103+
104+
So the native version may not be appropriate for all uses.
105+
106+
For the highest performance for long-running processes you want to use the
107+
JVM version of TruffleRuby, using `--jvm`.

doc/contributor/pre-initialization.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Context Pre-Initialization
22

3-
TruffleRuby supports context pre-initialization with SubstrateVM.
3+
TruffleRuby supports context pre-initialization with the GraalVM Native Image
4+
Generator.
45

5-
Context pre-initialization is enabled in Truffle by setting a Java property:
6+
Context pre-initialization is enabled by setting this Java property:
67

78
```
89
-Dpolyglot.engine.PreinitializeContexts=ruby

doc/contributor/profiling.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
There is no shortage of tools for profiling TruffleRuby. When running in JVM
44
mode, we can use standard JVM tooling, such as VisualVM and Java Flight
5-
Recorder. When run as a native image we can use callgrind from the Valgrind
6-
tool suite and other system tools, such as strace. As an instrumented Truffle
7-
language, we can also use Truffle's profiling capabilities and other [user
8-
tools](../user/tools.md). For a broad enough definition of profiling, we can
9-
also use the Ideal Graph Visualizer (IGV) and C1 Visualizer to inspect Graal's
10-
output.
5+
Recorder. When run as a Native Image we can use callgrind from the Valgrind
6+
tool suite and other system tools, such as strace. As a GraalVM language we
7+
can also use other GraalVM [tools](../user/tools.md). For a broad enough
8+
definition of profiling, we can also use the Ideal Graph Visualizer (IGV) and
9+
C1 Visualizer to inspect Graal's output.
1110

1211
This document is less about how to use each tool and more about suggestions for extracting
1312
the most useful information from the tools, assuming basic knowledge of their usage.
@@ -76,4 +75,4 @@ might have a different image manipulation application configured as the default
7675
for SVG files. While loading the file in such an application make render a graph, it likely
7776
will not handle the interactive components of the flame graph. Firefox may work as well,
7877
but Chromium-based browsers seem to have better support and performance for the flame graph
79-
files as of this writing (Dec. 2018).
78+
files as of this writing (Dec. 2018).

doc/contributor/svm.md

Lines changed: 0 additions & 105 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
require 'readline'
1212

1313
unless TruffleRuby.graal?
14-
puts 'You need Graal to run this'
14+
puts 'You need the GraalVM Compiler to run this'
1515
exit
1616
end
1717

doc/user/compatibility.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ as their semantics fundamentally do not match the technology that we are using.
4646
#### Fork
4747

4848
You cannot `fork` the TruffleRuby interpreter. The feature is unlikely to ever
49-
be supported when running on the JVM but could be supported in the future on
50-
the SVM. The correct and portable way to test if `fork` is available is:
49+
be supported when running on the JVM but could be supported in the future in
50+
the native configuration. The correct and portable way to test if `fork` is
51+
available is:
52+
5153
```ruby
5254
Process.respond_to?(:fork)
5355
```
@@ -250,7 +252,7 @@ multiple languages, including Java, instead.
250252
#### Java to Ruby interop
251253

252254
Calling Ruby code from Java is supported by the
253-
[Graal-SDK polyglot API](http://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/package-summary.html).
255+
[GraalVM polyglot API](http://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/package-summary.html).
254256

255257
#### Java extensions
256258

@@ -267,12 +269,13 @@ extensions to Ruby.
267269

268270
* Java interop
269271

270-
Running TruffleRuby in the native configuration is mostly the same as running on
271-
the JVM. There are differences in resource management, as both VMs use different
272-
garbage collectors. But, functionality-wise, they are essentially on par with
273-
one another. The big difference is support for Java interop, which currently
274-
relies on reflection. TruffleRuby's implementation of Java interop does not work
275-
with the SVM's limited support for runtime reflection.
272+
Running TruffleRuby in the native configuration is mostly the same as running
273+
on the JVM. There are differences in resource management, as both VMs use
274+
different garbage collectors. But, functionality-wise, they are essentially on
275+
par with one another. The big difference is support for Java interop, which
276+
currently relies on reflection. TruffleRuby's implementation of Java interop
277+
does not work with the GraalVM Native Image Generator's limited support for
278+
runtime reflection.
276279

277280
## Spec Completeness
278281

0 commit comments

Comments
 (0)