Skip to content

Commit

Permalink
[GR-41361] Backports for 22.3
Browse files Browse the repository at this point in the history
PullRequest: truffleruby/3503
  • Loading branch information
eregon committed Oct 3, 2022
2 parents 94e4017 + 9a4bf72 commit 84b886d
Show file tree
Hide file tree
Showing 114 changed files with 1,186 additions and 1,083 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

New features:

* Foreign strings now have all methods of Ruby `String`. They are treated as `#frozen?` UTF-8 Ruby Strings.
* Foreign strings now have all methods of Ruby `String`. They are treated as `#frozen?` UTF-8 Ruby Strings (@eregon).
* Add `Java.add_to_classpath` method to add jar paths at runtime (#2693, @bjfish).
* Add support for Ruby 3.1's Hash shorthand/punning syntax (@nirvdrum).
* Add support for Ruby 3.1's anonymous block forwarding syntax (@nirvdrum).
Expand All @@ -17,6 +17,7 @@ Bug fixes:
* Disallow the marshaling of polyglot exceptions since we can't properly reconstruct them (@nirvdrum).
* Fix `String#split` missing a value in its return array when called with a pattern of `" "` and a _limit_ value > 0 on a string with trailing whitespace where the limit hasn't been met (@nirvdrum).
* Fix `Kernel#sleep` and `Mutex#sleep` for durations smaller than 1 millisecond (#2716, @eregon).
* Fix `IO#{wait,wait_readable,wait_writable}` with a timeout > INT_MAX seconds (@eregon).

Compatibility:

Expand All @@ -38,6 +39,9 @@ Compatibility:
* Implement `rb_ivar_foreach` to iterate over instance and class variables like in CRuby (#2701, @aardvark179).
* Fix the absolute path of the main script after chdir (#2709, @eregon).
* Fix exception for `Fiddle::Handle.new` with a missing library (#2714, @eregon).
* Fix arguments implicit type conversion for `BasicObject#instance_eval`, `Module#class_eval`, `Module#module_eval`, `Module#define_method` (@andrykonchin).
* Raise `ArgumentError` unconditionally when `Proc.new` is called without a block argument (@andrykonchin).
* Fix `UnboundMethod#hash` to not depend on a module it was retrieved from (#2728, @andrykonchin).

Performance:

Expand All @@ -48,12 +52,16 @@ Performance:

Changes:

* No more conversion between Java Strings and Ruby Strings at the interop boundary.
* No more conversion between Java Strings and Ruby Strings at the interop boundary (@eregon).
* Removed `Truffle::Interop.{import_without_conversion,export_without_conversion}` (use `Polyglot.{import,export}` instead).
* Removed `Truffle::Interop.members_without_conversion` (use `Truffle::Interop.members` instead).
* Refactored internals of `rb_sprintf` to simplify handling of `VALUE`s in common cases (@aardvark179).
* Refactored sharing of array objects between threads using new `SharedArrayStorage` (@aardvark179).

Security:

* The native access permission is now properly checked before any native pointer (e.g. `Truffle::FFI::Pointer`) is created (@eregon).

# 22.2.0

New features:
Expand Down
14 changes: 14 additions & 0 deletions ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ local part_definitions = {
JAVA_HOME: common.jdks["labsjdk-ce-17"],
},
},

v19: with_path {
downloads+: {
JAVA_HOME: common.jdks["labsjdk-ce-19"],
},
},
},

platform: {
Expand Down Expand Up @@ -537,10 +543,13 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
# Order: platform, jdk, mx_env. Keep aligned for an easy visual comparison.
"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:20:00" },
"ruby-test-specs-linux-17": $.platform.linux + $.jdk.v17 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:20:00" },
"ruby-test-specs-linux-19": $.platform.linux + $.jdk.v19 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:20:00" },
"ruby-test-specs-darwin-amd64-11": $.platform.darwin_amd64 + $.jdk.v11 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-specs-darwin-amd64-17": $.platform.darwin_amd64 + $.jdk.v17 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-specs-darwin-amd64-19": $.platform.darwin_amd64 + $.jdk.v19 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-specs-darwin-aarch64-11": $.platform.darwin_aarch64 + $.jdk.v11 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-specs-darwin-aarch64-17": $.platform.darwin_aarch64 + $.jdk.v17 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-specs-darwin-aarch64-19": $.platform.darwin_aarch64 + $.jdk.v19 + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-fast-linux-aarch64": $.platform.linux_aarch64 + $.jdk.v11 + $.env.jvm + gate + $.run.test_fast + native_config + { timelimit: "45:00" },
"ruby-test-fast-linux": $.platform.linux + $.jdk.v11 + $.env.jvm + gate + $.run.test_fast + { timelimit: "45:00" }, # To catch missing slow tags
"ruby-test-mri-linux": $.platform.linux + $.jdk.v11 + $.env.native + gate + $.run.test_mri + { timelimit: "01:20:00" },
Expand All @@ -559,15 +568,20 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "

"ruby-test-compiler-graal-core-11": $.platform.linux + $.jdk.v11 + $.env.jvm_ce + gate + $.use.truffleruby + $.run.test_compiler,
"ruby-test-compiler-graal-core-17": $.platform.linux + $.jdk.v17 + $.env.jvm_ce + gate + $.use.truffleruby + $.run.test_compiler,
"ruby-test-compiler-graal-core-19": $.platform.linux + $.jdk.v19 + $.env.jvm_ce + gate + $.use.truffleruby + $.run.test_compiler,
"ruby-test-compiler-graal-enterprise-11": $.platform.linux + $.jdk.v11 + $.env.jvm_ee + gate + $.use.truffleruby + $.run.test_compiler,
"ruby-test-compiler-graal-enterprise-17": $.platform.linux + $.jdk.v17 + $.env.jvm_ee + gate + $.use.truffleruby + $.run.test_compiler,
"ruby-test-compiler-graal-enterprise-19": $.platform.linux + $.jdk.v19 + $.env.jvm_ee + gate + $.use.truffleruby + $.run.test_compiler,

"ruby-test-svm-graal-core-linux-11": $.platform.linux + $.jdk.v11 + $.env.native + $.env.gdb_svm + gate + native_tests,
"ruby-test-svm-graal-core-linux-17": $.platform.linux + $.jdk.v17 + $.env.native + $.env.gdb_svm + gate + native_tests,
"ruby-test-svm-graal-core-linux-19": $.platform.linux + $.jdk.v19 + $.env.native + $.env.gdb_svm + gate + native_tests,
"ruby-test-svm-graal-core-darwin-amd64-11": $.platform.darwin_amd64 + $.jdk.v11 + $.env.native + $.env.gdb_svm + gate + native_tests,
"ruby-test-svm-graal-core-darwin-amd64-17": $.platform.darwin_amd64 + $.jdk.v17 + $.env.native + $.env.gdb_svm + gate + native_tests,
"ruby-test-svm-graal-core-darwin-amd64-19": $.platform.darwin_amd64 + $.jdk.v19 + $.env.native + $.env.gdb_svm + gate + native_tests,
"ruby-test-svm-graal-core-darwin-aarch64-11": $.platform.darwin_aarch64 + $.jdk.v11 + $.env.native + gate + native_tests,
"ruby-test-svm-graal-core-darwin-aarch64-17": $.platform.darwin_aarch64 + $.jdk.v17 + $.env.native + gate + native_tests,
"ruby-test-svm-graal-core-darwin-aarch64-19": $.platform.darwin_aarch64 + $.jdk.v19 + $.env.native + gate + native_tests,
"ruby-test-svm-graal-enterprise-linux": $.platform.linux + $.jdk.v11 + $.env.native_ee + $.env.gdb_svm + gate + native_tests,
"ruby-test-svm-graal-enterprise-darwin-aarch64 ": $.platform.darwin_aarch64 + $.jdk.v11 + $.env.native_ee + gate + native_tests,
},
Expand Down
32 changes: 16 additions & 16 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
"jdks": {
"openjdk11": {"name": "jpg-jdk", "version": "11.0.11", "build_id": "9", "open": true, "release": true, "platformspecific": true },
"oraclejdk11": {"name": "jpg-jdk", "version": "11.0.11", "build_id": "9", "release": true, "platformspecific": true, "extrabundles": ["static-libs"] },
"labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.17+5-jvmci-22.3-b05", "platformspecific": true },
"labsjdk-ce-11-llvm": {"name": "labsjdk", "version": "ce-11.0.17+5-jvmci-22.3-b05-sulong", "platformspecific": true },
"labsjdk-ee-11": {"name": "labsjdk", "version": "ee-11.0.17+9-jvmci-22.3-b05", "platformspecific": true },
"labsjdk-ee-11-llvm": {"name": "labsjdk", "version": "ee-11.0.17+9-jvmci-22.3-b05-sulong", "platformspecific": true },
"labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.17+5-jvmci-22.3-b06", "platformspecific": true },
"labsjdk-ce-11-llvm": {"name": "labsjdk", "version": "ce-11.0.17+5-jvmci-22.3-b06-sulong", "platformspecific": true },
"labsjdk-ee-11": {"name": "labsjdk", "version": "ee-11.0.17+10-jvmci-22.3-b06", "platformspecific": true },
"labsjdk-ee-11-llvm": {"name": "labsjdk", "version": "ee-11.0.17+10-jvmci-22.3-b06-sulong", "platformspecific": true },

"oraclejdk17": {"name": "jpg-jdk", "version": "17.0.1", "build_id": "12", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.5+5-jvmci-22.3-b05", "platformspecific": true },
"labsjdk-ce-17Debug": {"name": "labsjdk", "version": "ce-17.0.5+5-jvmci-22.3-b05-debug", "platformspecific": true },
"labsjdk-ce-17-llvm": {"name": "labsjdk", "version": "ce-17.0.5+5-jvmci-22.3-b05-sulong", "platformspecific": true },
"labsjdk-ee-17": {"name": "labsjdk", "version": "ee-17.0.5+8-jvmci-22.3-b05", "platformspecific": true },
"labsjdk-ee-17Debug": {"name": "labsjdk", "version": "ee-17.0.5+8-jvmci-22.3-b05-debug", "platformspecific": true },
"labsjdk-ee-17-llvm": {"name": "labsjdk", "version": "ee-17.0.5+8-jvmci-22.3-b05-sulong", "platformspecific": true },
"labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.5+5-jvmci-22.3-b06", "platformspecific": true },
"labsjdk-ce-17Debug": {"name": "labsjdk", "version": "ce-17.0.5+5-jvmci-22.3-b06-debug", "platformspecific": true },
"labsjdk-ce-17-llvm": {"name": "labsjdk", "version": "ce-17.0.5+5-jvmci-22.3-b06-sulong", "platformspecific": true },
"labsjdk-ee-17": {"name": "labsjdk", "version": "ee-17.0.5+9-jvmci-22.3-b06", "platformspecific": true },
"labsjdk-ee-17Debug": {"name": "labsjdk", "version": "ee-17.0.5+9-jvmci-22.3-b06-debug", "platformspecific": true },
"labsjdk-ee-17-llvm": {"name": "labsjdk", "version": "ee-17.0.5+9-jvmci-22.3-b06-sulong", "platformspecific": true },

"oraclejdk19": {"name": "jpg-jdk", "version": "19", "build_id": "26", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-19": {"name": "labsjdk", "version": "ce-19+36-jvmci-22.3-b05", "platformspecific": true },
"labsjdk-ce-19Debug": {"name": "labsjdk", "version": "ce-19+36-jvmci-22.3-b05-debug", "platformspecific": true },
"labsjdk-ce-19-llvm": {"name": "labsjdk", "version": "ce-19+36-jvmci-22.3-b05-sulong", "platformspecific": true },
"labsjdk-ee-19": {"name": "labsjdk", "version": "ee-19.0.1+9-jvmci-22.3-b05", "platformspecific": true },
"labsjdk-ee-19Debug": {"name": "labsjdk", "version": "ee-19.0.1+9-jvmci-22.3-b05-debug", "platformspecific": true },
"labsjdk-ee-19-llvm": {"name": "labsjdk", "version": "ee-19.0.1+9-jvmci-22.3-b05-sulong", "platformspecific": true }
"labsjdk-ce-19": {"name": "labsjdk", "version": "ce-19+36-jvmci-22.3-b06", "platformspecific": true },
"labsjdk-ce-19Debug": {"name": "labsjdk", "version": "ce-19+36-jvmci-22.3-b06-debug", "platformspecific": true },
"labsjdk-ce-19-llvm": {"name": "labsjdk", "version": "ce-19+36-jvmci-22.3-b06-sulong", "platformspecific": true },
"labsjdk-ee-19": {"name": "labsjdk", "version": "ee-19.0.1+10-jvmci-22.3-b06", "platformspecific": true },
"labsjdk-ee-19Debug": {"name": "labsjdk", "version": "ee-19.0.1+10-jvmci-22.3-b06--debug", "platformspecific": true },
"labsjdk-ee-19-llvm": {"name": "labsjdk", "version": "ee-19.0.1+10-jvmci-22.3-b06-sulong", "platformspecific": true }
},

"COMMENT.devkits" : "The devkits versions reflect those used to build the JVMCI JDKs (e.g., see devkit_platform_revisions in <jdk>/make/conf/jib-profiles.js)",
Expand Down
68 changes: 62 additions & 6 deletions doc/contributor/interop_details.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
- **a `Class`**
- **a `Hash`**
- **an `Array`**
- **an `Exception`**
- **an `Exception` with a cause**
- **`proc {...}`**
- **`lambda {...}`**
- **a `Method`**
Expand Down Expand Up @@ -307,11 +309,11 @@ When interop message `getHashValuesIterator` is sent
## Members related messages (incomplete)

When interop message `readMember` is sent
- to any non-immediate `Object` like **`nil`**, **`:symbol`**, **a `String`**, **a `BigDecimal`**, **an `Object`**, **a frozen `Object`**, **a `StructWithValue`**, **a `Class`**, **a `Hash`**, **an `Array`**, **`proc {...}`**, **`lambda {...}`**, **a `Method`**, **a `Truffle::FFI::Pointer`**, **polyglot pointer**, **polyglot array** or **polyglot hash**
- to any non-immediate `Object` like **`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 array** or **polyglot hash**
it returns a method with the given name when the method is defined.
- to any non-immediate `Object` like **`nil`**, **`:symbol`**, **a `String`**, **a `BigDecimal`**, **an `Object`**, **a frozen `Object`**, **a `StructWithValue`**, **a `Class`**, **a `Hash`**, **an `Array`**, **`proc {...}`**, **`lambda {...}`**, **a `Method`**, **a `Truffle::FFI::Pointer`**, **polyglot pointer**, **polyglot array** or **polyglot hash**
- to any non-immediate `Object` like **`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 array** or **polyglot hash**
it fails with `UnknownIdentifierException` when the method is not defined.
- to any non-immediate `Object` like **a `String`**, **an `Object`**, **a `StructWithValue`**, **a `Class`**, **a `Hash`**, **an `Array`**, **`proc {...}`**, **`lambda {...}`**, **a `Method`**, **a `Truffle::FFI::Pointer`**, **polyglot pointer**, **polyglot array** or **polyglot hash**
- to any non-immediate `Object` like **a `String`**, **an `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 array** or **polyglot hash**
it reads the given instance variable.
- to **polyglot members**
it reads the value stored with the given name.
Expand All @@ -321,7 +323,7 @@ When interop message `readMember` is sent
it fails with `UnsupportedMessageError`.

When interop message `writeMember` is sent
- to any non-immediate non-frozen `Object` like **a `String`**, **an `Object`**, **a `StructWithValue`**, **a `Class`**, **a `Hash`**, **an `Array`**, **`proc {...}`**, **`lambda {...}`**, **a `Method`**, **a `Truffle::FFI::Pointer`**, **polyglot pointer**, **polyglot array** or **polyglot hash**
- to any non-immediate non-frozen `Object` like **a `String`**, **an `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 array** or **polyglot hash**
it writes the given instance variable.
- to **polyglot members**
it writes the given value under the given name.
Expand All @@ -332,10 +334,64 @@ When interop message `writeMember` is sent
- otherwise
it fails with `UnsupportedMessageError`.

## Exception related messages

When interop message `isException` is sent
- to **an `Exception`** or **an `Exception` with a cause**
it returns true.
- otherwise
it returns false.

When interop message `throwException` is sent
- to **an `Exception`** or **an `Exception` with a cause**
it throws the exception.
- otherwise
it fails with `UnsupportedMessageError`.

When interop message `getExceptionType` is sent
- to **an `Exception`** or **an `Exception` with a cause**
it returns the exception type.
- otherwise
it fails with `UnsupportedMessageError`.

When interop message `hasExceptionMessage` is sent
- to **an `Exception`** or **an `Exception` with a cause**
it returns true.
- otherwise
it returns false.

When interop message `getExceptionMessage` is sent
- to **an `Exception`** or **an `Exception` with a cause**
it returns the message of the exception.
- otherwise
it fails with `UnsupportedMessageError`.

When interop message `hasExceptionStackTrace` is sent
- to **an `Exception`** or **an `Exception` with a cause**
it returns true.
- otherwise
it returns false.

When interop message `getExceptionStackTrace` is sent
- to **an `Exception`** or **an `Exception` with a cause**
it returns the stacktrace of the exception.
- otherwise
it fails with `UnsupportedMessageError`.

When interop message `hasExceptionCause` is sent
- to **an `Exception` with a cause**
it returns true.
- otherwise
it returns false.

When interop message `getExceptionCause` is sent
- to **an `Exception` with a cause**
it returns the cause of the exception.
- otherwise
it fails with `UnsupportedMessageError`.

## Number related messages (missing)

## Instantiation related messages (missing)

## Exception related messages (missing)

## Time related messages (unimplemented)
5 changes: 2 additions & 3 deletions lib/truffle/io/wait.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ def ready?
Truffle::IOOperations.poll(self, Truffle::IOOperations::POLLIN, 0)
end

def wait(timeout = nil)
def wait_readable(timeout = nil)
ensure_open_and_readable
Truffle::IOOperations.poll(self, Truffle::IOOperations::POLLIN, timeout) ? self : nil
end

alias_method :wait_readable, :wait
alias_method :wait, :wait_readable

def wait_writable(timeout = nil)
ensure_open_and_writable
Expand Down
5 changes: 5 additions & 0 deletions lib/truffle/truffle/patches/nokogiri_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ def self.using_system_libraries?
replacement: "VALUE thing = Qnil;\nVALUE errors = rb_ary_new();",
predicate: -> { using_system_libraries? }
},
{
match: 'VALUE retVal = Qnil;',
replacement: "VALUE retVal = Qnil;\nVALUE errors = rb_ary_new();",
predicate: -> { using_system_libraries? }
},
{
match: 'xmlSetStructuredErrorFunc(NULL, Nokogiri_error_raise);',
replacement: 'xmlSetStructuredErrorFunc(errors, Nokogiri_error_array_pusher);',
Expand Down
4 changes: 2 additions & 2 deletions mx.truffleruby/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "regex",
"subdir": True,
"version": "46235c96a132a7bb776a396fc26e31f5b5852c8c",
"version": "552ddc7f51fdf520ef68c876a27f8c62a4f65a1e",
"urls": [
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},
Expand All @@ -16,7 +16,7 @@
{
"name": "sulong",
"subdir": True,
"version": "46235c96a132a7bb776a396fc26e31f5b5852c8c",
"version": "552ddc7f51fdf520ef68c876a27f8c62a4f65a1e",
"urls": [
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},
Expand Down
Loading

0 comments on commit 84b886d

Please sign in to comment.