Skip to content

Commit 7d950d5

Browse files
committed
Merge branch 'master' into use-token-array-in-time_strftime
2 parents d207b65 + a8ba15f commit 7d950d5

Some content is hidden

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

58 files changed

+967
-549
lines changed

.spin/bin/env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
SCRIPT_PATH=$(dirname "$0")
44
SCRIPT_PATH=$(cd "$SCRIPT_PATH" && pwd)
55
TRUFFLERUBY_DIR=$SCRIPT_PATH/../..
6+
export JT_ENV=jvm-ce
67

78
unset JAVA_HOME
89

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Bug fixes:
1010
* `Truffle::POSIX.select` was being redefined repeatedly (#2332).
1111
* Fix the `--backtraces-raise` and `--backtraces-rescue` options in JVM mode (#2335).
1212
* Fix `File.{atime, mtime, ctime}` to include nanoseconds (#2337).
13+
* Fix `Array#[a, b] = "frozen string literal".freeze` (#2355).
14+
* `rb_funcall()` now releases the C-extension lock (similar to MRI).
1315

1416
Compatibility:
1517

@@ -27,6 +29,9 @@ Compatibility:
2729
* Implement `Fiber#raise` (#2338).
2830
* Update `File.basename` to return new `String` instances (#2343).
2931
* Allow `Fiber#raise` after `Fiber#transfer` like Ruby 3.0 (#2342).
32+
* Fix `ObjectSpace._id2ref` for Symbols and frozen String literals (#2358).
33+
* Implemented `Enumerator::Lazy#filter_map` (#2356).
34+
* Fix LLVM toolchain issue on macOS 10.13 (#2352, [oracle/graal#3383](https://github.com/oracle/graal/issues/3383)).
3035

3136
Performance:
3237

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,4 @@ For further licensing information, see [LICENCE](LICENCE.md), [3rd_party_license
191191

192192
## Attribution
193193

194-
TruffleRuby is a fork of [JRuby](https://github.com/jruby/jruby), combined with code from the [Rubinius](https://github.com/rubinius/rubinius) project, and code from the standard implementation of Ruby, [MRI](https://github.com/ruby/ruby).
194+
TruffleRuby includes infrastructure code from [JRuby](https://github.com/jruby/jruby) (e.g. parser, JCodings, Joni), core library code from the [Rubinius](https://github.com/rubinius/rubinius) project, as well as code from the standard implementation of Ruby, [MRI](https://github.com/ruby/ruby).

ci.jsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
488488
// Order: platform, jdk, mx_env. Keep aligned for an easy visual comparison.
489489
"ruby-test-specs-linux-8": $.platform.linux + $.jdk.v8 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:15:00" },
490490
"ruby-test-specs-linux-11": $.platform.linux + $.jdk.v11 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:15:00" },
491-
"ruby-test-specs-darwin-8": $.platform.darwin + $.jdk.v8 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:35:00" },
492-
"ruby-test-specs-darwin-11": $.platform.darwin + $.jdk.v11 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:35:00" },
491+
"ruby-test-specs-darwin-8": $.platform.darwin + $.jdk.v8 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
492+
"ruby-test-specs-darwin-11": $.platform.darwin + $.jdk.v11 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
493493
"ruby-test-fast-linux-arm64": $.platform.linux_arm64 + $.jdk.v11 + $.env.jvm + gate + $.run.test_fast + native_config + { timelimit: "45:00" },
494494
"ruby-test-fast-linux": $.platform.linux + $.jdk.v11 + $.env.jvm + gate + $.run.test_fast + { timelimit: "45:00" }, # To catch missing slow tags
495495
"ruby-test-mri-linux": $.platform.linux + $.jdk.v11 + $.env.jvm + gate + $.run.test_mri + { timelimit: "01:10:00" },

common.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
"README": "This file contains definitions that are useful for the hocon and jsonnet CI files of multiple repositories.",
33

44
"jdks": {
5-
"openjdk8": {"name": "openjdk", "version": "8u292+09-jvmci-21.2-b01", "platformspecific": true },
6-
"oraclejdk8": {"name": "oraclejdk", "version": "8u301+03-jvmci-21.2-b01", "platformspecific": true },
7-
"oraclejdk8Debug": {"name": "oraclejdk", "version": "8u301+03-jvmci-21.2-b01-fastdebug", "platformspecific": true },
5+
"openjdk8": {"name": "openjdk", "version": "8u302+02-jvmci-21.2-b02", "platformspecific": true },
6+
"oraclejdk8": {"name": "oraclejdk", "version": "8u301+05-jvmci-21.2-b02", "platformspecific": true },
7+
"oraclejdk8Debug": {"name": "oraclejdk", "version": "8u301+05-jvmci-21.2-b02-fastdebug", "platformspecific": true },
88

9-
"openjdk11": {"name": "openjdk", "version": "11.0.3+7", "platformspecific": true },
10-
"oraclejdk11": {"name": "oraclejdk", "version": "11.0.6+8", "platformspecific": true },
11-
"labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.11+8-jvmci-21.2-b01", "platformspecific": true },
12-
"labsjdk-ee-11": {"name": "labsjdk", "version": "ee-11.0.11+9-jvmci-21.2-b01", "platformspecific": true },
9+
"openjdk11": {"name": "openjdk", "version": "11.0.11+9", "platformspecific": true },
10+
"oraclejdk11": {"name": "oraclejdk", "version": "11.0.11+9", "platformspecific": true },
11+
"labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.11+8-jvmci-21.2-b02", "platformspecific": true },
12+
"labsjdk-ee-11": {"name": "labsjdk", "version": "ee-11.0.11+9-jvmci-21.2-b02", "platformspecific": true },
1313

1414
"oraclejdk16": {"name": "oraclejdk", "version": "16.0.1+4", "platformspecific": true },
15-
"labsjdk-ce-16": {"name": "labsjdk", "version": "ce-16.0.1+9-jvmci-21.2-b01", "platformspecific": true },
16-
"labsjdk-ce-16Debug": {"name": "labsjdk", "version": "ce-16.0.1+9-jvmci-21.2-b01-debug", "platformspecific": true },
17-
"labsjdk-ee-16": {"name": "labsjdk", "version": "ee-16.0.1+9-jvmci-21.2-b01", "platformspecific": true },
18-
"labsjdk-ee-16Debug": {"name": "labsjdk", "version": "ee-16.0.1+9-jvmci-21.2-b01-debug", "platformspecific": true }
15+
"labsjdk-ce-16": {"name": "labsjdk", "version": "ce-16.0.2+4-jvmci-21.2-b02", "platformspecific": true },
16+
"labsjdk-ce-16Debug": {"name": "labsjdk", "version": "ce-16.0.2+4-jvmci-21.2-b02-debug", "platformspecific": true },
17+
"labsjdk-ee-16": {"name": "labsjdk", "version": "ee-16.0.2+4-jvmci-21.2-b02", "platformspecific": true },
18+
"labsjdk-ee-16Debug": {"name": "labsjdk", "version": "ee-16.0.2+4-jvmci-21.2-b02-debug", "platformspecific": true }
1919
},
2020

2121
"COMMENT" : "The devkits versions reflect those used to build the JVMCI JDKs (e.g., see devkit_platform_revisions in <jdk>/make/conf/jib-profiles.js)",

lib/truffle/socket/basic_socket.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,9 @@ def recv(bytes_to_read, flags = 0, buf = nil)
175175
end
176176

177177
private def __recv_nonblock(bytes_to_read, flags, buf, exception)
178-
fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
178+
self.nonblock = true
179179

180-
Truffle::Socket::Error.wrap_read_nonblock do
181-
internal_recv(bytes_to_read, flags, buf, exception)
182-
end
180+
internal_recv(bytes_to_read, flags, buf, exception)
183181
end
184182

185183
private def internal_recvmsg(max_msg_len, flags, max_control_len, scm_rights, exception)
@@ -246,7 +244,7 @@ def recv(bytes_to_read, flags = 0, buf = nil)
246244
end
247245

248246
private def __recvmsg_nonblock(max_msg_len, flags, max_control_len, scm_rights, exception)
249-
fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
247+
self.nonblock = true
250248

251249
internal_recvmsg(max_msg_len, flags | Socket::MSG_DONTWAIT, max_control_len, scm_rights, exception)
252250
end
@@ -298,7 +296,7 @@ def recv(bytes_to_read, flags = 0, buf = nil)
298296
end
299297

300298
private def __sendmsg_nonblock(message, flags, dest_sockaddr, controls, exception)
301-
fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
299+
self.nonblock = true
302300

303301
internal_sendmsg(message, flags | Socket::MSG_DONTWAIT, dest_sockaddr, exception)
304302
end

lib/truffle/socket/socket.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,13 @@ def connect(sockaddr)
340340

341341
status = Truffle::Socket::Foreign.connect(Primitive.io_fd(self), sockaddr)
342342

343-
Truffle::Socket::Error.write_error('connect(2)', self) if status < 0
343+
Truffle::Socket::Error.connect_error('connect(2)', self) if status < 0
344344

345345
0
346346
end
347347

348348
private def __connect_nonblock(sockaddr, exception)
349-
fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
349+
self.nonblock = true
350350

351351
if sockaddr.is_a?(Addrinfo)
352352
sockaddr = sockaddr.to_sockaddr
@@ -356,15 +356,15 @@ def connect(sockaddr)
356356

357357
if status < 0
358358
if exception
359-
Truffle::Socket::Error.write_nonblock('connect(2)')
359+
Truffle::Socket::Error.connect_nonblock('connect(2)')
360360
else
361361
errno = Errno.errno
362362
if errno == Errno::EINPROGRESS::Errno
363363
:wait_writable
364364
elsif errno == Errno::EISCONN::Errno
365365
0
366366
else
367-
Truffle::Socket::Error.write_nonblock('connect(2)')
367+
Truffle::Socket::Error.connect_nonblock('connect(2)')
368368
end
369369
end
370370
else

lib/truffle/socket/truffle.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def self.accept(source, new_class)
131131
end
132132

133133
def self.accept_nonblock(source, new_class, exception)
134-
source.fcntl(::Fcntl::F_SETFL, ::Fcntl::O_NONBLOCK)
134+
source.nonblock = true
135135

136136
internal_accept(source, new_class, exception)
137137
end

lib/truffle/socket/truffle/error.rb

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,66 +27,60 @@
2727
module Truffle
2828
module Socket
2929
module Error
30+
def self.read_error(message, socket)
31+
if socket.nonblock?
32+
read_nonblock(message)
33+
else
34+
Errno.handle(message)
35+
end
36+
end
37+
3038
def self.write_error(message, socket)
31-
if nonblocking?(socket)
39+
if socket.nonblock?
3240
write_nonblock(message)
3341
else
3442
Errno.handle(message)
3543
end
3644
end
3745

38-
def self.read_error(message, socket)
39-
if nonblocking?(socket)
40-
read_nonblock(message)
46+
def self.connect_error(message, socket)
47+
if socket.nonblock?
48+
connect_nonblock(message)
4149
else
4250
Errno.handle(message)
4351
end
4452
end
4553

4654
# Handles an error for a non-blocking read operation.
4755
def self.read_nonblock(message)
48-
wrap_read_nonblock { Errno.handle(message) }
56+
errno = Errno.errno
57+
if errno == Errno::EAGAIN::Errno
58+
raise ::IO::EAGAINWaitReadable, message
59+
else
60+
Errno.handle_errno(errno, message)
61+
end
4962
end
5063

5164
# Handles an error for a non-blocking write operation.
5265
def self.write_nonblock(message)
53-
wrap_write_nonblock { Errno.handle(message) }
54-
end
55-
56-
def self.wrap_read_nonblock
57-
yield
58-
rescue Errno::EAGAIN => err
59-
raise_wrapped_error(err, ::IO::EAGAINWaitReadable)
60-
rescue Errno::EWOULDBLOCK => err
61-
raise_wrapped_error(err, ::IO::EWOULDBLOCKWaitReadable)
62-
rescue Errno::EINPROGRESS => err
63-
raise_wrapped_error(err, ::IO::EINPROGRESSWaitReadable)
64-
end
65-
66-
def self.wrap_write_nonblock
67-
yield
68-
rescue Errno::EAGAIN => err
69-
raise_wrapped_error(err, ::IO::EAGAINWaitWritable)
70-
rescue Errno::EWOULDBLOCK => err
71-
raise_wrapped_error(err, ::IO::EWOULDBLOCKWaitWritable)
72-
rescue Errno::EINPROGRESS => err
73-
raise_wrapped_error(err, ::IO::EINPROGRESSWaitWritable)
74-
end
75-
76-
# Wraps the error given in `original` in an instance of `error_class`.
77-
#
78-
# This can be used to wrap e.g. an Errno::EAGAIN error in an
79-
# ::IO::EAGAINWaitReadable instance.
80-
def self.raise_wrapped_error(original, error_class)
81-
error = error_class.new(original.message)
82-
83-
error.set_backtrace(original.backtrace)
84-
85-
raise error
66+
errno = Errno.errno
67+
if errno == Errno::EAGAIN::Errno
68+
raise ::IO::EAGAINWaitWritable, message
69+
else
70+
Errno.handle_errno(errno, message)
71+
end
8672
end
8773

88-
def self.nonblocking?(socket)
89-
socket.fcntl(::Fcntl::F_GETFL) & ::Fcntl::O_NONBLOCK > 0
74+
# Handles an error for a non-blocking connect operation.
75+
def self.connect_nonblock(message)
76+
errno = Errno.errno
77+
if errno == Errno::EAGAIN::Errno
78+
raise ::IO::EAGAINWaitWritable, message
79+
elsif errno == Errno::EINPROGRESS::Errno
80+
raise ::IO::EINPROGRESSWaitWritable, message
81+
else
82+
Errno.handle_errno(errno, message)
83+
end
9084
end
9185
end
9286
end

lib/truffle/socket/udp_socket.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def connect(host, port)
5656

5757
status = Truffle::Socket::Foreign.connect(Primitive.io_fd(self), sockaddr)
5858

59-
Truffle::Socket::Error.write_error('connect(2)', self) if status < 0
59+
Truffle::Socket::Error.connect_error('connect(2)', self) if status < 0
6060

6161
0
6262
end
@@ -74,7 +74,7 @@ def send(message, flags, host = nil, port = nil)
7474
end
7575

7676
private def __recvfrom_nonblock(maxlen, flags, buffer, exception)
77-
fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
77+
self.nonblock = true
7878

7979
flags = 0 if flags.nil?
8080

0 commit comments

Comments
 (0)