Skip to content

Commit 1afc6b2

Browse files
committed
Merge branch 'origin/master' into release/graal-vm/1.0
2 parents 0c60fae + e732478 commit 1afc6b2

File tree

154 files changed

+3538
-1560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+3538
-1560
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ src/main/c/*/*.bc
4747
src/main/c/*/*.su
4848
src/main/c/*/extconf.h
4949
src/main/c/*/mkmf.log
50+
src/main/c/sulongmock/sulongmock.c
5051
src/main/c/truffleposix/truffleposix.o
5152
src/main/c/truffleposix/truffleposix.so
5253
src/main/c/truffleposix/truffleposix.dylib

3rd_party_licenses.txt

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,15 @@
1-
LICENSING INFORMATION
2-
===============================================================================
1+
LICENSING INFORMATION
2+
TruffleRuby
33

4+
===============================================================================
45

5-
LICENSES FOR THIRD-PARTY COMPONENTS
6+
LICENSES FOR THIRD-PARTY COMPONENTS
67

78
The following sections contain licensing information for libraries that we have
89
included with the GraalVM Community Edition 1.0 source and components used to
910
test GraalVM Community Edition 1.0. We are thankful to all individuals that
1011
have created these.
1112
The following software may be included in this product:
12-
--------------------------------------------------------------------------------
13-
pr-zlib
14-
License for pr-zlib
15-
16-
This library is covered under the same license as zlib itself. For the text
17-
of the zlib license, please see http://zlib.net/zlib_license.html.
18-
19-
....
20-
21-
/* zlib.h -- interface of the 'zlib' general purpose compression library
22-
version 1.2.11, January 15th, 2017
23-
24-
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
25-
26-
This software is provided 'as-is', without any express or implied
27-
warranty. In no event will the authors be held liable for any damages
28-
arising from the use of this software.
29-
30-
Permission is granted to anyone to use this software for any purpose,
31-
including commercial applications, and to alter it and redistribute it
32-
freely, subject to the following restrictions:
33-
34-
1. The origin of this software must not be misrepresented; you must not
35-
claim that you wrote the original software. If you use this software
36-
in a product, an acknowledgment in the product documentation would be
37-
appreciated but is not required.
38-
2. Altered source versions must be plainly marked as such, and must not be
39-
misrepresented as being the original software.
40-
3. This notice may not be removed or altered from any source distribution.
41-
42-
Jean-loup Gailly Mark Adler
43-
jloup@gzip.org madler@alumni.caltech.edu
44-
45-
*/
4613
--------------------------------------------------------------------------------
4714

4815
Ruby

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# 1.0 RC 2, May 2018
22

3+
# 1.0 RC 3
4+
5+
New features:
6+
7+
* `is_a?` can be called on foreign objects.
8+
9+
Bug fixes:
10+
11+
* It is no longer needed to have `ruby` in `$PATH` to run the post-install hook.
12+
* `Qnil`/`Qtrue`/`Qfalse`/`Qundef` can now be used as initial value for global
13+
variables in C extensions.
14+
* Fixed error message when the runtime libssl has no SSLv2 support (on Ubuntu
15+
16.04 for instance).
16+
* `RbConfig::CONFIG['extra_bindirs']` is now a String as other RbConfig values.
17+
* `SIGPIPE` is correctly caught on SubstrateVM, and the corresponding write()
18+
raises `Errno::EPIPE` when the read end of a pipe or socket is closed.
19+
20+
Performance:
21+
22+
* Faster stat()-related calls, by returning the relevant field directly and
23+
avoiding extra allocations.
24+
* `rb_str_new()`/`rb_str_new_cstr()` are much faster by avoiding extra copying and
25+
allocations.
26+
27+
# 1.0 RC 2, May 2018
28+
329
New features:
430

531
* We are now compatible with Ruby 2.4.4.
@@ -26,6 +52,8 @@ New features:
2652
Changes:
2753

2854
* The version string now mentions `GraalVM CE` or `EE`.
55+
* The version string now mentions if you're running GraalVM Community Edition
56+
(`GraalVM CE`) or GraalVM Enterprise Edition (`GraalVM EE`).
2957

3058
* The inline JavaScript functionality `-Xinline_js` has been removed.
3159

ci.jsonnet

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ local part_definitions = {
240240
["mx", "fetch-languages", "--language:llvm", "--language:ruby"],
241241
# aot-build.log is used for the build-stats metrics
242242
[
243-
"./native-image",
244-
"--no-server",
243+
"mx",
244+
"native-image",
245245
"--language:ruby",
246246
"-H:Path=$SVM_HOME/svmbuild/native-image-root/languages/ruby/bin",
247247
"-H:Name=truffleruby",
@@ -293,9 +293,12 @@ local part_definitions = {
293293
downloads+: {
294294
JAVA_HOME: {
295295
name: "oraclejdk",
296-
version: "10+46", // 46 is the GA of Java 10
296+
version: "10+46", # 46 is the GA of Java 10
297297
platformspecific: true,
298298
},
299+
300+
# We need a JDK 8 to compile TruffleRuby
301+
EXTRA_JAVA_HOMES: $.jdk.labsjdk8.downloads["JAVA_HOME"],
299302
},
300303

301304
environment+: {
@@ -729,7 +732,7 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
729732

730733
release_builds:
731734
{
732-
local shared = $.use.common + { timelimit: "35:00" },
735+
local shared = $.use.common + { timelimit: "40:00" },
733736
"ruby-test-standalone-distribution": $.platform.linux + $.cap.gate + $.jdk.openjdk8 + shared + $.run.test_make_standalone_distribution,
734737
"ruby-standalone-distribution-linux": $.platform.linux + $.cap.manual + $.jdk.openjdk8 + shared + $.run.make_standalone_distribution,
735738
"ruby-standalone-distribution-darwin": $.platform.darwin + $.cap.manual + $.jdk.labsjdk8 + shared + $.run.make_standalone_distribution,

doc/contributor/docker.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ Fedora 25 using RVM:
2424
$ jt docker print --fedora25 --source --rvm
2525
```
2626

27-
Or, to run a full set of tests on a new release candidate:
27+
Or, to run a full set of tests on a set of new release candidate tarballs:
2828

2929
```
30-
$ jt docker test --graalvm graalvm.tar.gz ruby.jar --test release_branch
30+
$ jt docker test --graalvm graalvm-ce.tar.gz ruby-installable.jar --test release_branch
31+
$ jt docker test --graalvm graalvm-ee.tar.gz ruby-installable.jar --test release_branch
32+
$ jt docker test --graalvm graalvm-ee.tar.gz ruby-installable.jar --rebuild-images --test release_branch
3133
```
3234

3335
## Distributions
@@ -42,8 +44,9 @@ Pick one of:
4244

4345
Pick one of:
4446

45-
* From the public GraalVM CE binary tarball, and the public Ruby component, `--public 1.0.0rc-1` (default)
47+
* From the public GraalVM CE binary tarball, and the public Ruby component, `--public 1.0.0` (default)
4648
* From a GraalVM binary tarball and Ruby component you have locally, `--graalvm graalvm.tar.gz ruby-installable.jar`
49+
* From a TruffleRuby standalone distribution you have locally, `--standalone truffleruby-1.0.0-linux-amd64.tar.gz`
4750
* From source, `--source master`
4851

4952
## Ruby manager
@@ -69,9 +72,15 @@ Pick any of:
6972
* Rebuild images after installing the Ruby component, `--rebuild-images`
7073
* Run a full set of Docker tests we care about, `test` instead of `build`
7174
* Use a custom TruffleRuby repo, `--repo url`
75+
* Do not rebuild `openssl`, to test error messages, `--no-rebuild-openssl`
7276

7377
When using `test` you need to specify the method of installing, and what to do.
7478

79+
## Extracting a standalone image
80+
81+
To extract a standalone image, use `jt docker extract-standalone ~/Downloads/ruby-installable-linux-amd64-rc2.jar 1.0.0-rc2`.
82+
The file name needs to have the platform in it, as it is on GitHub.
83+
7584
## Docker cache
7685

7786
You may find that the Docker cache interacts badly with these Dockerfiles (such

doc/contributor/extensions-in-gems.md

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

doc/contributor/interop.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,16 @@ looks at the underlying Java object.
417417
`object.to_str` will try to `UNBOX` the object and return it if it's a `String`,
418418
or will raise `NoMethodError` if it isn't.
419419

420+
`java_object.is_a?(java_class)` does `java_object instanceof java_class`, using
421+
the host object instance, rather than any runtime interop wrapper.
422+
423+
`object.is_a?(java_class)` does `object instanceof java_class`, using the
424+
runtime object instance.
425+
426+
`foreign_object.is_a?(ruby_class)` returns `false`.
427+
428+
`foreign_object.is_a?(foreign_class)` raises a `TypeError`.
429+
420430
`object.respond_to?(:to_a)`, `respond_to?(:to_ary)` and `respond_to?(:size)`
421431
sends `HAS_SIZE`.
422432

@@ -426,14 +436,12 @@ sends `HAS_SIZE`.
426436

427437
`object.respond_to?(:class)` calls `Truffle::Interop.java_class?(object)`.
428438

429-
`object.respond_to?(name)` for other names returns `false`.
430-
431-
`object.respond_to?(:inspect)` is `true`.
432-
433-
`object.respond_to?(:to_s)` is `true`.
439+
`object.respond_to?(:inspect)`, `:to_s`, `:is_a?`, is `true`.
434440

435441
`object.respond_to?(:to_str)` is `true` if the object `UNBOXes` to a `String`.
436442

443+
`object.respond_to?(name)` for other names returns `false`.
444+
437445
`object.__send__(name, *args)` works in the same way as literal method call on
438446
the foreign object, including allowing the special-forms listed above (see
439447
[notes on method resolution](#notes-on-method-resolution)).
@@ -509,6 +517,8 @@ type is supported for interop.
509517

510518
`Truffle::Interop.java_class?(object)`
511519

520+
`Truffle::Interop.java_instanceof?(object, class)`
521+
512522
`Truffle::Interop.java_string?(object)`
513523

514524
`Truffle::Interop.to_java_string(ruby_string)`
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Assumptions Third Party Code Makes About TruffleRuby
2+
3+
When third-party code starts to make assumptions about the way TruffleRuby does
4+
something, such as a `TruffleRuby` method, or the layout of our distribution, we
5+
record it here so that we know who is using it if we need to change something
6+
about it.
7+
8+
## TruffleRuby Extensions in Gems
9+
10+
* `concurrent-ruby` using `TruffleRuby.full_memory_barrier` (actually it is using
11+
`Truffle::System.full_memory_barrier` - need to update).

doc/user/compatibility.md

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,6 @@ disabled where we dynamically detect that they probably won't be used. See the
135135

136136
## C Extension Compatibility
137137

138-
#### Identifiers may be macros or functions
139-
140-
Identifiers which are normally macros may be functions, functions may be macros,
141-
and global variables may be macros. This causes problems where they are used in
142-
a context which relies on a particular implementation, for example a global
143-
variable assigned to an initial value which was a macro, like `Qnil`, which is
144-
a macro that evaluates to a function call in TruffleRuby.
145-
146-
For example, this global variable definition does not work because `Qnil` expands
147-
to be a function call in TruffleRuby:
148-
149-
```c
150-
static VALUE foo = Qnil;
151-
```
152-
153-
A workaround is to assign `foo` in your C extension `Init_` function, or inside
154-
some other function.
155-
156138
#### Storing Ruby objects in native structures and arrays
157139

158140
You cannot store a Ruby object in a structure or array that has been natively
@@ -176,6 +158,15 @@ but they cannot contain both in the same program run. If you have a global you
176158
assign `NULL` to (`NULL` being just `0` and so a native address) you cannot
177159
then assign managed data to this variable.
178160

161+
#### Identifiers may be macros or functions
162+
163+
Identifiers which are normally macros may be functions, functions may be macros,
164+
and global variables may be macros. This may cause problems where they are used
165+
in a context which relies on a particular implementation (e.g., taking the
166+
address of it, assigning to a function pointer variable and using defined() to
167+
check if a macro exists). These issues should all be considered bugs and be
168+
fixed, please report these cases.
169+
179170
#### Variadic functions
180171

181172
Variadic arguments of type `VALUE` that hold Ruby objects can be used, but they

doc/user/installing-libssl.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Installing `libssl`
22

33
TruffleRuby provides the `openssl` module but not the native `libssl` system
4-
library that the module uses. TruffleRuby requires version 1.0.2.
4+
library that the module uses. TruffleRuby supports both versions 1.0.2 and 1.1.0.
55

6-
Version 1.1.0 or more recent is incompatible, so you might need to install a
7-
compatibility version of `libssl`.
6+
If you experience `openssl`-related errors, it might help to recompile the
7+
`openssl` module by running `lib/truffle/post_install_hook.sh`.
8+
This is done automatically by Ruby managers, and mentioned in the post-install
9+
message when installing TruffleRuby via `gu install` in GraalVM.
810

911
## Oracle Linux
1012

@@ -18,27 +20,22 @@ sudo yum install openssl-devel
1820
apt-get install libssl-dev
1921
```
2022

21-
We recommend `libssl-dev` instead of `libssl1.0.0`, even though we aren't using
22-
it for development because the latter doesn't seem to put the shared library in
23-
a place where we can find it.
23+
After installing GraalVM and Ruby you will need to rebuild `openssl` for the
24+
version in Ubuntu - run `lib/truffle/post_install_hook.sh`.
2425

2526
After installing GraalVM and Ruby you will need to rebuild `openssl` for the
2627
version in Ubuntu - run `lib/truffle/post_install_hook.sh`. Make sure you run
2728
it with TruffleRuby on your `$PATH`.
2829

2930
## Fedora
3031

31-
On Fedora 25 or older, the default openssl is correct, so you only need to
32-
install `openssl-devel`:
32+
On Fedora 25 or more recent, the default openssl is compatible, so you only need
33+
to install `openssl-devel`:
3334

3435
```
3536
sudo dnf install openssl-devel
3637
```
3738

38-
We recommend `openssl-devel` instead of `openssl`, even though we aren't using
39-
it for development because the latter doesn't seem to put the shared library in
40-
a place where we can find it.
41-
4239
## macOS
4340

4441
On macOS the system version is too old. We recommend installing via

doc/user/installing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ rebuild the Ruby executable images using the runtime from the Enterprise
6464
Edition. The version of the Ruby executable images you install by default uses
6565
the Community Edition runtime until you rebuild.
6666

67-
To get the best performance you want to rebuild the images. Check with `ruby
68-
--version` that it says you are running `EE` rather than `CE`.
67+
To get the best performance you want to rebuild the images. Check that `ruby
68+
--version` reports that you are running `GraalVM EE` rather than `GraalVM CE`.
6969

7070
Rebuilding the executable images can take a few minutes and you should have
7171
about 8 GB of RAM available.
7272

7373
```
74-
$ graalvm/jre/lib/svm/bin/rebuild-images ruby
74+
$ gu rebuild-images ruby
7575
```
7676

7777
## Using a Ruby package manager

doc/user/truffleruby-additions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ TruffleRuby outside of GraalVM, such as a standard JVM, the version will be
3030
`'0.0'`. You can find the version number of GraalVM and TruffleRuby using the
3131
standard `RUBY_ENGINE_VERSION` constant.
3232

33-
## Truffle methods
33+
## TruffleRuby methods
3434

3535
TruffleRuby provides these non-standard methods that provide additional
3636
functionality in the `TruffleRuby` module.

lib/cext/include/ruby/ruby.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,15 @@ enum ruby_special_consts {
420420
RUBY_SPECIAL_SHIFT = 8
421421
};
422422

423-
VALUE rb_tr_get_undef(void);
424-
VALUE rb_tr_get_true(void);
425-
VALUE rb_tr_get_false(void);
426-
VALUE rb_tr_get_nil(void);
427-
428-
#define Qfalse rb_tr_get_false()
429-
#define Qtrue rb_tr_get_true()
430-
#define Qnil rb_tr_get_nil()
431-
#define Qundef rb_tr_get_undef()
423+
extern void* rb_tr_undef;
424+
extern void* rb_tr_true;
425+
extern void* rb_tr_false;
426+
extern void* rb_tr_nil;
427+
428+
#define Qfalse ((VALUE)(&rb_tr_false))
429+
#define Qtrue ((VALUE)(&rb_tr_true))
430+
#define Qnil ((VALUE)(&rb_tr_nil))
431+
#define Qundef ((VALUE)(&rb_tr_undef))
432432

433433
#define IMMEDIATE_MASK RUBY_IMMEDIATE_MASK
434434
#define FIXNUM_FLAG RUBY_FIXNUM_FLAG

lib/cext/include/truffleruby/constants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// From ./tool/generate-cext-constants.rb
22

3+
VALUE rb_tr_get_undef(void);
4+
VALUE rb_tr_get_true(void);
5+
VALUE rb_tr_get_false(void);
6+
VALUE rb_tr_get_nil(void);
37
VALUE rb_tr_get_Array(void);
48
VALUE rb_tr_get_Class(void);
59
VALUE rb_tr_get_Comparable(void);

0 commit comments

Comments
 (0)