Skip to content

Commit 8e1f1e9

Browse files
committed
[GR-37533] Merge master into 24.0 release branch for feature freeze
PullRequest: truffleruby/4144
2 parents 6bb8840 + 42ae5ce commit 8e1f1e9

File tree

2,613 files changed

+51293
-65754
lines changed

Some content is hidden

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

2,613 files changed

+51293
-65754
lines changed

3rd_party_licenses.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ of
13081308
*/
13091309
================================================================================
13101310

1311-
ffi 1.14.2
1311+
ffi 1.15.5
13121312

13131313
Copyright (c) 2008-2016, Ruby FFI project contributors
13141314
All rights reserved.

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
New features:
44

55
* C/C++ extensions are now compiled using the system toolchain and executed natively instead of using GraalVM LLVM (Sulong). This leads to faster startup, no warmup, better compatibility, smaller distribution and faster installation for C/C++ extensions (#3118, @eregon).
6+
* Full suport for the Ruby 3.2 and Ruby 3.3 syntax by adopting the [Prism](https://github.com/ruby/prism) parser, which is about twice as fast as the old parser (#3117, #3038, #3039, @andrykonchin, @eregon).
7+
* Pattern matching is now fully supported, with the exception of Find pattern (`in [*, a, *]`) (#3332, #2683, @eregon, @razetime).
68

79
Bug fixes:
810

@@ -12,6 +14,13 @@ Bug fixes:
1214
* Fix `Proc#parameters` and return all the numbered parameters lower than the used explicitly ones (@andrykonchin).
1315
* Fix some C API functions which were failing when called with Ruby values represented as Java primitives (#3352, @eregon).
1416
* Fix `IO.select([io], nil, [io])` on macOS, it was hanging due to a bug in macOS `poll(2)` (#3346, @eregon, @andrykonchin).
17+
* Run context cleanup such as showing the output of tools when `SignalException` and `Interrupt` escape (@eregon).
18+
* Handle a new variable inside the `case` target expression correctly (#3377, @eregon).
19+
* The arguments of `Thread.new(*args, &block)` need to be marked as shared between multiple threads (#3179, @eregon).
20+
* Fix `Range#bsearch` and raise `TypeError` when range boundaries are non-numeric and block not passed (@andrykonchin).
21+
* Fix using the `--cpusampler` profiler when there are custom unblock functions for `rb_thread_call_without_gvl()` (#3013, @eregon).
22+
* Fix recursive raising `FrozenError` exception when redefined `#inspect` modifies an object (#3388, @andrykonchin).
23+
* Fix `Integer#div` returning the wrong object type when the divisor is a `Rational` (@simonlevasseur, @nirvdrum).
1524

1625
Compatibility:
1726

@@ -21,6 +30,21 @@ Compatibility:
2130
* Promote `File#path` and `File#to_path` to `IO#path` and `IO#to_path` and make IO#new accept an optional `path:` keyword argument (#3039, @moste00)
2231
* Display "unhandled exception" as the message for `RuntimeError` instances with an empty message (#3255, @nirvdrum).
2332
* Set `RbConfig::CONFIG['configure_args']` for openssl and libyaml (#3170, #3303, @eregon).
33+
* Support `Socket.sockaddr_in(port, Socket::INADDR_ANY)` (#3361, @mtortonesi).
34+
* Implement the `Data` class from Ruby 3.2 (#3039, @moste00, @eregon).
35+
* Make `Coverage.start` and `Coverage.result` accept parameters (#3149, @mtortonesi, @andrykonchin).
36+
* Implement `rb_check_funcall()` (@eregon).
37+
* Implement `MatchData#{byteoffset,deconstruct,deconstruct_keys}` from Ruby 3.2 (#3039, @rwstauner).
38+
* Add `Integer#ceildiv` method (#3039, @simonlevasseur, @nirvdrum).
39+
* Implement `Class#attached_object` method (#3039, @andrykonchin).
40+
* Fix `ENV#{clone,dup}` and raise `TypeError` (#3039, @andrykonchin).
41+
* Fix `Coverage.supported?` and raise `TypeError` if argument is not Symbol (#3039, @andrykonchin).
42+
* Accept options argument to `Regexp.{new,compile}` of String and warn for unknown types (#3039, @rwstauner).
43+
* Implement `Time#deconstruct_keys` from Ruby 3.2 (#3039, @rwstauner).
44+
* Do not autosplat a proc that accepts a single positional argument and keywords (#3039, @andrykonchin).
45+
* Support passing anonymous * and ** parameters as method call arguments (#3039, @andrykonchin).
46+
* Handle either positional or keywords arguments by default in `Struct.new` (#3039, @rwstauner).
47+
* Promote `Set` class to core library (#3039, @andrykonchin).
2448

2549
Performance:
2650

LICENCE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TruffleRuby Licence
22

3-
TruffleRuby is copyright (c) 2013-2023 Oracle and/or its affiliates, and is made
3+
TruffleRuby is copyright (c) 2013-2024 Oracle and/or its affiliates, and is made
44
available to you under the terms of any one of the following three licenses:
55

66
* Eclipse Public License version 2.0, or

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ TruffleRuby is actively tested on the following systems:
9090
* Ubuntu 16.04, 18.04, 20.04, 22.04 (all LTS)
9191
* Fedora 37, 38
9292
* Debian 10, 11, 12
93-
* macOS 10.14 (Mojave) for amd64, 11 (Big Sur) for aarch64
93+
* macOS 11 (Big Sur)
9494

9595
Architectures:
9696

@@ -182,7 +182,7 @@ For known vulnerabilities in Ruby, please refer to the [known-cves](doc/user/kno
182182

183183
## Licence
184184

185-
TruffleRuby is copyright (c) 2013-2023 Oracle and/or its affiliates, and is made
185+
TruffleRuby is copyright (c) 2013-2024 Oracle and/or its affiliates, and is made
186186
available to you under the terms of any one of the following three licenses:
187187

188188
* Eclipse Public License version 2.0, or

ci.jsonnet

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ local part_definitions = {
251251
platform_name:: "DarwinAMD64",
252252
"$.cap":: {
253253
# GR-45839, GR-46279: exclude macmini_late_2014_8gb, they are too slow, have too little RAM and cause various timeouts
254-
normal_machine: ["darwin_mojave", "!macmini_late_2014_8gb"],
254+
normal_machine: ["darwin_bigsur", "!macmini_late_2014_8gb"],
255255
},
256256
environment+: {
257257
LANG: "en_US.UTF-8",
@@ -521,14 +521,14 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
521521
"ruby-test-specs-linux-amd64-stable": $.platform.linux + $.jdk.stable + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:20:00" },
522522
"ruby-test-specs-linux-amd64-latest": $.platform.linux + $.jdk.latest + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:20:00" },
523523
"ruby-test-specs-darwin-amd64-stable": $.platform.darwin_amd64 + $.jdk.stable + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
524-
# "ruby-test-specs-darwin-amd64-latest": $.platform.darwin_amd64 + $.jdk.latest + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" }, # GR-49652
524+
"ruby-test-specs-darwin-amd64-latest": $.platform.darwin_amd64 + $.jdk.latest + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
525525
"ruby-test-specs-darwin-aarch64-stable": $.platform.darwin_aarch64 + $.jdk.stable + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
526526
"ruby-test-specs-darwin-aarch64-latest": $.platform.darwin_aarch64 + $.jdk.latest + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
527527
"ruby-test-fast-linux-aarch64": $.platform.linux_aarch64 + $.jdk.stable + $.env.jvm + gate + $.run.test_fast + native_config + { timelimit: "45:00" },
528528
"ruby-test-fast-linux-amd64": $.platform.linux + $.jdk.stable + $.env.jvm + gate + $.run.test_fast + { timelimit: "45:00" }, # To catch missing slow tags
529-
"ruby-test-mri-asserts": $.platform.linux + $.jdk.stable + $.env.jvm + gate + $.run.test_mri_fast + { timelimit: "01:30:00" },
529+
"ruby-test-mri-asserts": $.platform.linux + $.jdk.stable + $.env.jvm + gate + $.run.test_mri_fast + { timelimit: "01:15:00" },
530530
"ruby-test-mri-linux-amd64": $.platform.linux + $.jdk.stable + $.env.native + gate + $.run.test_mri + { timelimit: "01:20:00" },
531-
"ruby-test-mri-linux-aarch64": $.platform.linux_aarch64 + $.jdk.stable + $.env.native + gate + $.run.test_mri + { timelimit: "01:20:00" },
531+
# "ruby-test-mri-linux-aarch64": $.platform.linux_aarch64 + $.jdk.stable + $.env.native + gate + $.run.test_mri + { timelimit: "01:30:00" }, # GR-51361
532532
"ruby-test-mri-darwin-amd64": $.platform.darwin_amd64 + $.jdk.stable + $.env.native + gate + $.run.test_mri + { timelimit: "01:30:00" },
533533
"ruby-test-mri-darwin-aarch64": $.platform.darwin_aarch64 + $.jdk.stable + $.env.native + gate + $.run.test_mri + { timelimit: "01:30:00" },
534534
"ruby-test-integration-linux-amd64": $.platform.linux + $.jdk.stable + $.env.jvm + gate + $.run.test_integration,
@@ -551,7 +551,7 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
551551
"ruby-test-svm-ce-linux-amd64-stable": $.platform.linux + $.jdk.stable + $.env.native + $.env.gdb_svm + gate + native_tests + $.env.host_inlining_log,
552552
"ruby-test-svm-ce-linux-amd64-latest": $.platform.linux + $.jdk.latest + $.env.native + $.env.gdb_svm + gate + native_tests,
553553
"ruby-test-svm-ce-darwin-amd64-stable": $.platform.darwin_amd64 + $.jdk.stable + $.env.native + $.env.gdb_svm + gate + native_tests,
554-
# "ruby-test-svm-ce-darwin-amd64-latest": $.platform.darwin_amd64 + $.jdk.latest + $.env.native + $.env.gdb_svm + gate + native_tests, # GR-49652
554+
"ruby-test-svm-ce-darwin-amd64-latest": $.platform.darwin_amd64 + $.jdk.latest + $.env.native + $.env.gdb_svm + gate + native_tests,
555555
"ruby-test-svm-ce-darwin-aarch64-stable": $.platform.darwin_aarch64 + $.jdk.stable + $.env.native + gate + native_tests,
556556
"ruby-test-svm-ce-darwin-aarch64-latest": $.platform.darwin_aarch64 + $.jdk.latest + $.env.native + gate + native_tests,
557557
"ruby-test-svm-ee-linux-amd64": $.platform.linux + $.jdk.stable + $.env.native_ee + $.env.gdb_svm + gate + native_tests + $.env.host_inlining_log + { timelimit: "01:30:00" },

ci/common.jsonnet

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ local common_json = import "../common.json";
344344
},
345345

346346
local linux = { os:: "linux", capabilities+: [self.os] },
347-
local darwin = { os:: "darwin", capabilities+: [self.os] },
347+
# Run darwin jobs on Big Sur or later by excluding all older versions
348+
local darwin = { os:: "darwin", capabilities+: [self.os, "!darwin_sierra", "!darwin_mojave", "!darwin_catalina"] },
348349
local windows = { os:: "windows", capabilities+: [self.os] },
349350

350351
local amd64 = { arch:: "amd64", capabilities+: [self.arch] },

common.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@
4444
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b26-debug", "platformspecific": true },
4545
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b26-sulong", "platformspecific": true },
4646

47-
"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "27", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
48-
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+27-jvmci-b01", "platformspecific": true },
49-
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+27-jvmci-b01-debug", "platformspecific": true },
50-
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+27-jvmci-b01-sulong", "platformspecific": true },
51-
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+27-jvmci-b01", "platformspecific": true },
52-
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+27-jvmci-b01-debug", "platformspecific": true },
53-
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+27-jvmci-b01-sulong", "platformspecific": true }
47+
"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "33", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
48+
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+33-jvmci-b01", "platformspecific": true },
49+
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+33-jvmci-b01-debug", "platformspecific": true },
50+
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+33-jvmci-b01-sulong", "platformspecific": true },
51+
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+33-jvmci-b01", "platformspecific": true },
52+
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+33-jvmci-b01-debug", "platformspecific": true },
53+
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+33-jvmci-b01-sulong", "platformspecific": true }
5454
},
5555

5656
"eclipse": {

doc/contributor/how-to-guide.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,24 +1139,6 @@ jt -q ruby -e 'puts Truffle::Debug.java_class_of([])'
11391139
RubyArray
11401140
```
11411141
1142-
### Truffle::Debug.yarp_serialize
1143-
1144-
```
1145-
jt -q ruby -e 'puts Truffle::Debug.yarp_serialize("1").dump'
1146-
"YARP\x00\x04\x00@7\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00L\f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00S\x19\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00&\b\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00"
1147-
```
1148-
1149-
### Truffle::Debug.yarp_parse
1150-
1151-
```
1152-
jt -q ruby -e 'puts Truffle::Debug.yarp_parse("[].to_ary")'
1153-
ProgramNode
1154-
Scope
1155-
StatementsNode
1156-
CallNode
1157-
ArrayNode
1158-
```
1159-
11601142
### Truffle::Debug.ast
11611143
11621144
```

doc/contributor/interop_details.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,28 @@
7878

7979
# Behavior of interop messages for Ruby objects
8080

81+
## toDisplayString()
82+
83+
When interop message `toDisplayString` is sent
84+
- to
85+
it returns a String representing the object.
86+
- otherwise
87+
it returns the same as `subject.inspect`.
88+
89+
## MetaObject related messages
90+
91+
When interop message `hasMetaObject` is sent
92+
- to **`nil`**, **`:symbol`**, **a `String`**, **a `BigDecimal`**, **an `Object`**, **a frozen `Object`**, **a `StructWithValue`**, **a `Class`**, **a `Hash`**, **an `Array`**, **an `Exception`**, **an `Exception` with a cause**, **`proc {...}`**, **`lambda {...}`**, **a `Method`**, **a `Truffle::FFI::Pointer`**, **polyglot pointer**, **polyglot members**, **polyglot array** or **polyglot hash**
93+
it returns true.
94+
- otherwise
95+
it returns false.
96+
97+
When interop message `getMetaObject` is sent
98+
- to
99+
it returns the Ruby exception's class.
100+
- otherwise
101+
it returns the same Ruby class as `subject.class`.
102+
81103
## `null` related messages
82104

83105
When interop message `isNull` is sent
@@ -329,7 +351,7 @@ When interop message `writeMember` is sent
329351
it writes the given value under the given name.
330352
- to **a `StructWithValue`**
331353
it writes the value to the given struct member.
332-
- to **a `BigDecimal`**, **`nil`**, **`:symbol`** or **a frozen `Object`**
354+
- to **`nil`**, **`false`**, **`true`**, **`:symbol`**, **an `Integer`**, **a `Float`**, **a `BigDecimal`** or **a frozen `Object`**
333355
it fails with `UnsupportedMessageError` when the receiver is frozen.
334356
- otherwise
335357
it fails with `UnsupportedMessageError`.

doc/contributor/parser.md

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

doc/contributor/prism.md

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,74 @@
88

99
## Print Detailed Prism AST
1010

11+
### From the Prism repository
12+
1113
```bash
12-
cd prism
13-
bundle exec rake
14-
bin/parse -e '1&.itself'
14+
$ cd prism
15+
$ bundle exec rake compile
16+
$ bin/parse -e '1&.itself'
17+
@ ProgramNode (location: (1,0)-(1,9))
18+
├── locals: []
19+
└── statements:
20+
@ StatementsNode (location: (1,0)-(1,9))
21+
└── body: (length: 1)
22+
└── @ CallNode (location: (1,0)-(1,9))
23+
├── flags: safe_navigation
24+
├── receiver:
25+
│ @ IntegerNode (location: (1,0)-(1,1))
26+
│ └── flags: decimal
27+
├── call_operator_loc: (1,1)-(1,3) = "&."
28+
├── name: :itself
29+
├── message_loc: (1,3)-(1,9) = "itself"
30+
├── opening_loc: ∅
31+
├── arguments: ∅
32+
├── closing_loc: ∅
33+
└── block: ∅
1534
```
1635

36+
### From TruffleRuby
37+
1738
We can also see what the AST as Java nodes and without extra location fields looks like on TruffleRuby with:
1839
```bash
19-
cd truffleruby
20-
jt -q ruby -e 'puts Truffle::Debug.yarp_parse(ARGV[0])' -- '1&.itself'
40+
$ cd truffleruby
41+
$ jt -q ruby tool/parse_ast.rb '1&.itself'
42+
Source:
43+
1&.itself
44+
45+
AST:
46+
ProgramNode
47+
locals:
48+
statements: StatementsNode
49+
body:
50+
CallNode[Li]
51+
flags: 1
52+
receiver: IntegerNode
53+
flags: 2
54+
name: "itself"
55+
arguments: null
56+
block: null
57+
```
58+
59+
```bash
60+
$ jt -q ruby tool/parse_ast.rb some_file.rb
61+
```
62+
63+
You can also compare to JRuby's AST with:
64+
```bash
65+
$ jruby tool/parse_ast.rb '1&.itself'
66+
Source:
67+
1&.itself
68+
69+
AST:
70+
RootNode line: 0
71+
CallNode*[lazy]:itself line: 0
72+
FixnumNode line: 0, long: 1
73+
, null, null
74+
```
75+
76+
## Print the Truffle AST
77+
78+
```bash
79+
$ cd truffleruby
80+
$ jt -q ruby tool/truffle_ast.rb '1&.itself'
2181
```

doc/contributor/updating-jruby-parser.md

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

doc/contributor/workflow.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,3 @@ file to fix it.
321321

322322
You can also recompute the tags automatically for an entire test file with
323323
`jt retag test/mri/tests/file.rb`.
324-
325-
## Building the parser
326-
327-
TruffleRuby uses the Jay parser generator. A copy of this is located in
328-
`tool/jay`. The command `jt build parser` will build Jay, if needed, and then
329-
regenerate the parser. We check the generated parser into the source repository.

doc/legal/legal.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ which are the only supported ways to use TruffleRuby.
55

66
## TruffleRuby
77

8-
TruffleRuby is copyright (c) 2013-2023 Oracle and/or its
8+
TruffleRuby is copyright (c) 2013-2024 Oracle and/or its
99
affiliates, and is made available to you under the terms of any one of the
1010
following three licenses:
1111

@@ -165,9 +165,14 @@ files.
165165

166166
#### FFI
167167

168-
TruffleRuby includes parts of the FFI gem 1.14.2. The FFI gem is copyright
169-
2008-2016, Ruby FFI project contributors, and covered by the three-clause BSD
170-
licence (see `ffi.txt`).
168+
TruffleRuby includes parts of the FFI gem (version as described in [lib/truffle/ffi/version.rb](../../lib/truffle/ffi/version.rb)).
169+
The FFI gem is copyright 2008-2016, Ruby FFI project contributors, and covered by the three-clause BSD licence (see `ffi.txt`).
170+
171+
#### Prism
172+
173+
TruffleRuby uses the [Prism](https://github.com/ruby/prism) Ruby parser
174+
(version as described in [src/main/c/yarp/include/prism/version.h](../../src/main/c/yarp/include/prism/version.h)),
175+
copyright Shopify Inc. and is available under an MIT licence (see `src/main/c/yarp/LICENSE.md`).
171176

172177
# Java dependencies
173178

@@ -203,14 +208,6 @@ Engine Yard and are released under an MIT licence (see `mit.txt`).
203208
We do not distribute the FFI Specs, but they are copyright 2008-2014
204209
Ruby-FFI contributors and are released under an MIT licence (see `mit.txt`).
205210

206-
## Jay
207-
208-
TruffleRuby uses the Jay parser generator, modified from
209-
https://github.com/jruby/jay revision `9ffc59a`. Jay is copyright 1989 The
210-
Regents of the University of California, ported by Axel T. Schreiner, and is
211-
covered by the three-clause BSD licence (see `jay.txt`). We only distribute Jay
212-
in the source repository - it isn't part of releases.
213-
214211
## Written offer for source code
215212

216213
For any software that you receive from Oracle in binary form which is licensed

0 commit comments

Comments
 (0)