Skip to content

Commit 188942b

Browse files
committed
3.3.0-0nkmi2 with early backports
Backports the following patches which fixes critical or major issues: - ruby/ruby#9457 - ruby/ruby#9415 - https://bugs.ruby-lang.org/issues/20184 ruby/ruby#9498 - https://bugs.ruby-lang.org/issues/20085 ruby/ruby#9385
1 parent b3d8ccb commit 188942b

6 files changed

+168
-0
lines changed

debian/changelog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
ruby3.3 (3.3.0-0nkmi2~dist) unstable; urgency=medium
2+
3+
* Early backport: https://github.com/ruby/ruby/pull/9457
4+
* Early backport: https://github.com/ruby/ruby/pull/9415
5+
* Early backport: https://bugs.ruby-lang.org/issues/20184 https://github.com/ruby/ruby/pull/9498
6+
* Early backport: https://bugs.ruby-lang.org/issues/20085 https://github.com/ruby/ruby/pull/9385
7+
8+
-- Sorah Fukumori <[email protected]> Wed, 17 Jan 2024 17:31:21 +0900
9+
110
ruby3.3 (3.3.0-0nkmi1~dist) unstable; urgency=medium
211

312
* Happy Ruby 3.3!
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From: Aaron Patterson <[email protected]>
2+
Date: Thu, 11 Jan 2024 16:05:21 -0800
3+
Subject: Handle mmap failures for redblack tree cache
4+
5+
The redblack tree cache is totally optional, so if we can't allocate
6+
room for the cache, then just pretend as if the cache is full if mmap
7+
fails
8+
---
9+
shape.c | 8 ++++++++
10+
1 file changed, 8 insertions(+)
11+
12+
diff --git a/shape.c b/shape.c
13+
index 4cd4acd..8d8314d 100644
14+
--- a/shape.c
15+
+++ b/shape.c
16+
@@ -1233,6 +1233,14 @@ Init_default_shapes(void)
17+
rb_shape_tree_ptr->shape_cache = (redblack_node_t *)mmap(NULL, rb_size_mul_or_raise(REDBLACK_CACHE_SIZE, sizeof(redblack_node_t), rb_eRuntimeError),
18+
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
19+
rb_shape_tree_ptr->cache_size = 0;
20+
+
21+
+ // If mmap fails, then give up on the redblack tree cache.
22+
+ // We set the cache size such that the redblack node allocators think
23+
+ // the cache is full.
24+
+ if (GET_SHAPE_TREE()->shape_cache == MAP_FAILED) {
25+
+ GET_SHAPE_TREE()->shape_cache = 0;
26+
+ GET_SHAPE_TREE()->cache_size = REDBLACK_CACHE_SIZE;
27+
+ }
28+
#endif
29+
30+
// Shapes by size pool
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
From: Yuta Saito <[email protected]>
2+
Date: Wed, 27 Dec 2023 06:22:45 +0000
3+
Subject: Use consistent default options for `-mbranch-protection`
4+
5+
We need to use the same options for both C compiler and assembler
6+
when `-mbranch-protection` is guessed by configure. Otherwise,
7+
`coroutine/arm64/Context.{h,S}` will use incompatible PAC strategies.
8+
---
9+
configure.ac | 3 +++
10+
1 file changed, 3 insertions(+)
11+
12+
diff --git a/configure.ac b/configure.ac
13+
index e4f9cc1..a7b1c77 100644
14+
--- a/configure.ac
15+
+++ b/configure.ac
16+
@@ -830,7 +830,10 @@ AS_IF([test "$GCC" = yes], [
17+
AS_FOR(option, opt, [-mbranch-protection=pac-ret -msign-return-address=all], [
18+
RUBY_TRY_CFLAGS(option, [branch_protection=yes], [branch_protection=no])
19+
AS_IF([test "x$branch_protection" = xyes], [
20+
+ # C compiler and assembler must be consistent for -mbranch-protection
21+
+ # since they both check `__ARM_FEATURE_PAC_DEFAULT` definition.
22+
RUBY_APPEND_OPTION(XCFLAGS, option)
23+
+ RUBY_APPEND_OPTION(ASFLAGS, option)
24+
break
25+
])
26+
])
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
From: Takashi Kokubun <[email protected]>
2+
Date: Thu, 4 Jan 2024 14:53:44 -0800
3+
Subject: YJIT: Let RubyVM::YJIT.enable respect --yjit-stats
4+
5+
---
6+
test/ruby/test_yjit.rb | 14 +++++++++++++-
7+
yjit.rb | 6 +++++-
8+
yjit/src/yjit.rs | 8 +++++---
9+
3 files changed, 23 insertions(+), 5 deletions(-)
10+
11+
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
12+
index 9d3ec2f..55b86be 100644
13+
--- a/test/ruby/test_yjit.rb
14+
+++ b/test/ruby/test_yjit.rb
15+
@@ -67,7 +67,19 @@ class TestYJIT < Test::Unit::TestCase
16+
RUBY
17+
end
18+
19+
- def test_yjit_enable_stats
20+
+ def test_yjit_enable_stats_false
21+
+ assert_separately(["--yjit-disable", "--yjit-stats"], <<~RUBY, ignore_stderr: true)
22+
+ assert_false RubyVM::YJIT.enabled?
23+
+ assert_nil RubyVM::YJIT.runtime_stats
24+
+
25+
+ RubyVM::YJIT.enable
26+
+
27+
+ assert_true RubyVM::YJIT.enabled?
28+
+ assert_true RubyVM::YJIT.runtime_stats[:all_stats]
29+
+ RUBY
30+
+ end
31+
+
32+
+ def test_yjit_enable_stats_true
33+
args = []
34+
args << "--disable=yjit" if RubyVM::YJIT.enabled?
35+
assert_separately(args, <<~RUBY, ignore_stderr: true)
36+
diff --git a/yjit.rb b/yjit.rb
37+
index 0365e16..a228611 100644
38+
--- a/yjit.rb
39+
+++ b/yjit.rb
40+
@@ -28,7 +28,11 @@ module RubyVM::YJIT
41+
Primitive.rb_yjit_reset_stats_bang
42+
end
43+
44+
- # Enable \YJIT compilation.
45+
+ # Enable \YJIT compilation. `stats` option decides whether to enable \YJIT stats or not.
46+
+ #
47+
+ # * `false`: Disable stats.
48+
+ # * `true`: Enable stats. Print stats at exit.
49+
+ # * `:quiet`: Enable stats. Do not print stats at exit.
50+
def self.enable(stats: false)
51+
return false if enabled?
52+
at_exit { print_and_dump_stats } if stats
53+
diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs
54+
index cd51ed0..50335a7 100644
55+
--- a/yjit/src/yjit.rs
56+
+++ b/yjit/src/yjit.rs
57+
@@ -171,9 +171,11 @@ pub extern "C" fn rb_yjit_code_gc(_ec: EcPtr, _ruby_self: VALUE) -> VALUE {
58+
pub extern "C" fn rb_yjit_enable(_ec: EcPtr, _ruby_self: VALUE, gen_stats: VALUE, print_stats: VALUE) -> VALUE {
59+
with_vm_lock(src_loc!(), || {
60+
// Initialize and enable YJIT
61+
- unsafe {
62+
- OPTIONS.gen_stats = gen_stats.test();
63+
- OPTIONS.print_stats = print_stats.test();
64+
+ if gen_stats.test() {
65+
+ unsafe {
66+
+ OPTIONS.gen_stats = gen_stats.test();
67+
+ OPTIONS.print_stats = print_stats.test();
68+
+ }
69+
}
70+
yjit_init();
71+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From: Hiroshi SHIBATA <[email protected]>
2+
Date: Tue, 9 Jan 2024 17:14:51 +0900
3+
Subject: racc is extracted at Ruby 3.3, not 3.4
4+
5+
---
6+
lib/bundled_gems.rb | 2 +-
7+
1 file changed, 1 insertion(+), 1 deletion(-)
8+
9+
diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb
10+
index 0bb2a7c..5528672 100644
11+
--- a/lib/bundled_gems.rb
12+
+++ b/lib/bundled_gems.rb
13+
@@ -13,6 +13,7 @@ module Gem::BUNDLED_GEMS
14+
"net-pop" => "3.1.0",
15+
"net-smtp" => "3.1.0",
16+
"prime" => "3.1.0",
17+
+ "racc" => "3.3.0",
18+
"abbrev" => "3.4.0",
19+
"base64" => "3.4.0",
20+
"bigdecimal" => "3.4.0",
21+
@@ -22,7 +23,6 @@ module Gem::BUNDLED_GEMS
22+
"mutex_m" => "3.4.0",
23+
"nkf" => "3.4.0",
24+
"observer" => "3.4.0",
25+
- "racc" => "3.4.0",
26+
"resolv-replace" => "3.4.0",
27+
"rinda" => "3.4.0",
28+
"syslog" => "3.4.0",

debian/patches/series

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ TestProcess-disable-gems-to-disable-rubygems_integration.patch
88
extract-gems-sequential-Keep-using-RUNRUBY.patch
99
Test_SyncDefaultGems-Fail-when-editor-run.patch
1010
sync_default_gems-git-2.32-ignores-no-edit-in-cherry-pick.patch
11+
Use-consistent-default-options-for-mbranch-protection.patch
12+
Handle-mmap-failures-for-redblack-tree-cache.patch
13+
YJIT-Let-RubyVM-YJIT.enable-respect-yjit-stats.patch
14+
racc-is-extracted-at-Ruby-3.3-not-3.4.patch

0 commit comments

Comments
 (0)