Skip to content

Commit 019856d

Browse files
committed
New upstream version 3.3.4
1 parent e612f0b commit 019856d

File tree

23 files changed

+444
-45
lines changed

23 files changed

+444
-45
lines changed

ChangeLog

Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,298 @@
11
-*- coding: utf-8 -*-
22

3+
commit be1089c8ec5ba40e09b1553e36b3174bf4014d9d
4+
Author: Takashi Kokubun <[email protected]>
5+
AuthorDate: 2024-07-09 08:28:22 +0900
6+
Commit: Takashi Kokubun <[email protected]>
7+
CommitDate: 2024-07-09 08:28:22 +0900
8+
9+
v3.3.4
10+
11+
commit 17e21d815583ef7d6be03f29e90a219602497626
12+
Author: Takashi Kokubun <[email protected]>
13+
AuthorDate: 2024-07-09 08:08:42 +0900
14+
Commit: Takashi Kokubun <[email protected]>
15+
CommitDate: 2024-07-09 08:08:42 +0900
16+
17+
merge revision(s) fc33559c: [Backport #20570]
18+
19+
clear `kw_flag` if given hash is nil
20+
21+
https://bugs.ruby-lang.org/issues/20570 is caused I missed to
22+
clear the `kw_flag` even if `keyword_hash` is nil.
23+
24+
commit df8a08fb6a1f173a9c25db15fbe390096f39c2ff
25+
Author: Takashi Kokubun <[email protected]>
26+
AuthorDate: 2024-07-09 08:04:30 +0900
27+
Commit: Takashi Kokubun <[email protected]>
28+
CommitDate: 2024-07-09 08:04:30 +0900
29+
30+
merge revision(s) 75aaeb35b82da26359b9418d2963384d0c55839c: [Backport #20239]
31+
32+
[Bug #20239] Fix overflow at down-casting
33+
34+
commit 9d583dd43a24354e8ae58c089cf091c1243e6e60
35+
Author: Takashi Kokubun <[email protected]>
36+
AuthorDate: 2024-07-09 07:58:13 +0900
37+
Commit: Takashi Kokubun <[email protected]>
38+
CommitDate: 2024-07-09 07:58:13 +0900
39+
40+
merge revision(s) fba8aff7, d8c6e91748871ab2287d7703347847fe18a292d2: [Backport #20592]
41+
42+
[Bug #20592] Fix segfault when sending NULL to freeaddrinfo
43+
44+
On alpine freeaddrinfo does not accept NULL pointer
45+
46+
Fix dangling `else`
47+
48+
commit 8a2e41d34b135046957e1195a5d4f4967a82a965
49+
Author: Takashi Kokubun <[email protected]>
50+
AuthorDate: 2024-07-09 07:55:17 +0900
51+
Commit: Takashi Kokubun <[email protected]>
52+
CommitDate: 2024-07-09 07:55:17 +0900
53+
54+
merge revision(s) 2dd46bb82ffc4dff01d7ea70922f0e407acafb4e: [Backport #20468]
55+
56+
[Bug #20468] Fix safe navigation in `for` variable
57+
58+
commit a40645e115e6cd6328bb302dfc78b16f6ad45938
59+
Author: Takashi Kokubun <[email protected]>
60+
AuthorDate: 2024-07-09 07:42:06 +0900
61+
Commit: Takashi Kokubun <[email protected]>
62+
CommitDate: 2024-07-09 07:42:06 +0900
63+
64+
merge revision(s) 01b13886: [Backport #20562]
65+
66+
[Bug #20562] Categorize `RUBY_FREE_AT_EXIT` warning as experimental
67+
68+
commit 9a8454ea5ca2bb4d6540d5c43b8e91e199ed1a8a
69+
Author: Takashi Kokubun <[email protected]>
70+
AuthorDate: 2024-07-09 07:40:26 +0900
71+
Commit: Takashi Kokubun <[email protected]>
72+
CommitDate: 2024-07-09 07:40:28 +0900
73+
74+
Fix malformed JSON in macOS CI
75+
76+
commit f811f79b3aa5d1fba3a9a631a802aa1d41fa5dc4
77+
Author: Hiroshi SHIBATA <[email protected]>
78+
AuthorDate: 2024-07-06 00:13:11 +0900
79+
Commit: GitHub <[email protected]>
80+
CommitDate: 2024-07-06 00:13:11 +0900
81+
82+
Refine macOS CI (#11107)
83+
84+
Update macos runners with latest environments.
85+
86+
* Use macos-14 instead of macos-arm-oss
87+
* Removed macos-11 and added macos-13
88+
89+
commit b2be36ef3349ebdab5423ea3337c03bcc3319b60
90+
Author: Ivo Anjo <[email protected]>
91+
AuthorDate: 2024-07-04 01:56:00 +0900
92+
Commit: GitHub <[email protected]>
93+
CommitDate: 2024-07-04 01:56:00 +0900
94+
95+
[Backport #11036] Add explicit compiler fence when pushing frames to ensure safe profiling (#11090)
96+
97+
**What does this PR do?**
98+
99+
This PR tweaks the `vm_push_frame` function to add an explicit compiler
100+
fence (`atomic_signal_fence`) to ensure profilers that use signals
101+
to interrupt applications (stackprof, vernier, pf2, Datadog profiler)
102+
can safely sample from the signal handler.
103+
104+
This is a backport of #11036 to Ruby 3.3 .
105+
106+
**Motivation:**
107+
108+
The `vm_push_frame` was specifically tweaked in
109+
https://github.com/ruby/ruby/pull/3296 to initialize the a frame
110+
before updating the `cfp` pointer.
111+
112+
But since there's nothing stopping the compiler from reordering
113+
the initialization of a frame (`*cfp =`) with the update of the cfp
114+
pointer (`ec->cfp = cfp`) we've been hesitant to rely on this on
115+
the Datadog profiler.
116+
117+
In practice, after some experimentation + talking to folks, this
118+
reordering does not seem to happen.
119+
120+
But since modern compilers have a way for us to exactly tell them
121+
not to do the reordering (`atomic_signal_fence`), this seems even
122+
better.
123+
124+
I've actually extracted `vm_push_frame` into the "Compiler Explorer"
125+
website, which you can use to see the assembly output of this function
126+
across many compilers and architectures: https://godbolt.org/z/3oxd1446K
127+
128+
On that link you can observe two things across many compilers:
129+
1. The compilers are not reordering the writes
130+
2. The barrier does not change the generated assembly output
131+
(== has no cost in practice)
132+
133+
**Additional Notes:**
134+
135+
The checks added in `configure.ac` define two new macros:
136+
* `HAVE_STDATOMIC_H`
137+
* `HAVE_DECL_ATOMIC_SIGNAL_FENCE`
138+
139+
Since Ruby generates an arch-specific `config.h` header with
140+
these macros upon installation, this can be used by profilers
141+
and other libraries to test if Ruby was compiled with the fence enabled.
142+
143+
**How to test the change?**
144+
145+
As I mentioned above, you can check https://godbolt.org/z/3oxd1446K
146+
to confirm the compiled output of `vm_push_frame` does not change
147+
in most compilers (at least all that I've checked on that site).
148+
149+
commit 291cc913503475a204c93a53a2f470c8cc6bfca2
150+
Author: Peter Zhu <[email protected]>
151+
AuthorDate: 2024-06-29 05:04:49 +0900
152+
Commit: GitHub <[email protected]>
153+
CommitDate: 2024-06-29 05:04:49 +0900
154+
155+
[Bug #20598] Fix corruption of internal encoding string (#11069)
156+
157+
Fix corruption of internal encoding string
158+
159+
[Bug #20598]
160+
161+
Just like [Bug #20595], Encoding#name_list and Encoding#aliases can have
162+
their strings corrupted when Encoding.default_internal is set to nil.
163+
164+
Co-authored-by: Matthew Valentine-House <[email protected]>
165+
166+
commit 7a780a3ef766e0622ade4a5fbf2518f73c38282b
167+
Author: Peter Zhu <[email protected]>
168+
AuthorDate: 2024-06-27 23:46:53 +0900
169+
Commit: GitHub <[email protected]>
170+
CommitDate: 2024-06-27 23:46:53 +0900
171+
172+
[Bug #20595] Fix corruption of encoding name string (#11063)
173+
174+
Fix corruption of encoding name string
175+
176+
[Bug #20595]
177+
178+
enc_set_default_encoding will free the C string if the encoding is nil,
179+
but the C string can be used by the encoding name string. This will cause
180+
the encoding name string to be corrupted.
181+
182+
Consider the following code:
183+
184+
Encoding.default_internal = Encoding::ASCII_8BIT
185+
names = Encoding.default_internal.names
186+
p names
187+
Encoding.default_internal = nil
188+
p names
189+
190+
It outputs:
191+
192+
["ASCII-8BIT", "BINARY", "internal"]
193+
["ASCII-8BIT", "BINARY", "\x00\x00\x00\x00\x00\x00\x00\x00"]
194+
195+
Co-authored-by: Matthew Valentine-House <[email protected]>
196+
197+
commit 01762837b7f98934e402c6888e15de32a673b0fd
198+
Author: Hiroshi SHIBATA <[email protected]>
199+
AuthorDate: 2024-06-21 02:57:19 +0900
200+
Commit: GitHub <[email protected]>
201+
CommitDate: 2024-06-21 02:57:19 +0900
202+
203+
[Bug #20581][3.3] Fix unintentional truncation for dependencies of bundled gems (#11006)
204+
205+
* Try to load original gemspec from `.bundle/gems/foo-x.y.z/foo.gemspec`.
206+
207+
`.bundle/specification/foo-x.y.z.gemspec` may be changed our toolchain
208+
209+
* Try to find gemspec from `.bundle/specifications
210+
211+
* Adjust indent
212+
213+
commit 3160434c506fe2c7c9c69965dceb6e8fd7357c28
214+
Author: Takashi Kokubun <[email protected]>
215+
AuthorDate: 2024-06-21 02:41:13 +0900
216+
Commit: Takashi Kokubun <[email protected]>
217+
CommitDate: 2024-06-21 02:41:13 +0900
218+
219+
Add k0kubun to ruby_3_3 CODEOWNERS
220+
221+
commit d1ffd5ecfa62a049b7c508f30b6912a890de1b32
222+
Author: Jean byroot Boussier <[email protected]>
223+
AuthorDate: 2024-06-21 02:39:20 +0900
224+
Commit: GitHub <[email protected]>
225+
CommitDate: 2024-06-21 02:39:20 +0900
226+
227+
String.new(capacity:) don't substract termlen (#11027)
228+
229+
[Bug #20585]
230+
231+
This was changed in 36a06efdd9f0604093dccbaf96d4e2cb17874dc8 because
232+
`String.new(1024)` would end up allocating `1025` bytes, but the problem
233+
with this change is that the caller may be trying to right size a String.
234+
235+
So instead, we should just better document the behavior of `capacity:`.
236+
237+
Co-authored-by: Jean Boussier <[email protected]>
238+
239+
commit a3eb5e5c70eaee12964cdd807b8f19950003141f
240+
Author: Aaron Patterson <[email protected]>
241+
AuthorDate: 2024-06-14 02:02:32 +0900
242+
Commit: GitHub <[email protected]>
243+
CommitDate: 2024-06-14 02:02:32 +0900
244+
245+
Don't call `Warning.warn` unless the category is enabled (#10981)
246+
247+
Don't call `Warning.warn` unless the category is enabled
248+
249+
The warning category should be enabled if we want to call
250+
`Warning.warn`.
251+
252+
This commit speeds up the following benchmark:
253+
254+
```ruby
255+
eval "def test; " +
256+
1000.times.map { "' '.chomp!" }.join(";") + "; end"
257+
258+
def run_benchmark count
259+
i = 0
260+
while i < count
261+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
262+
yield
263+
ms = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
264+
puts "itr ##{i}: #{(ms * 1000).to_i}ms"
265+
i += 1
266+
end
267+
end
268+
269+
run_benchmark(25) do
270+
250.times do
271+
test
272+
end
273+
end
274+
```
275+
276+
On `master` this runs at about 92ms per iteration. With this patch, it
277+
is 7ms per iteration.
278+
279+
[Bug #20573]
280+
281+
commit aa957546fa553abadd888ba18675c099df1178e0
282+
Author: Alan Wu <[email protected]>
283+
AuthorDate: 2024-06-14 02:02:02 +0900
284+
Commit: GitHub <[email protected]>
285+
CommitDate: 2024-06-14 02:02:02 +0900
286+
287+
Bump shlex from 1.1.0 to 1.3.0 in /yjit/bindgen (#10985)
288+
289+
`yjit-bindgen` isn't run to build Ruby releases at all, but people might
290+
be running security scanners on the source tarball. Upgrade this
291+
dependency to calm the scanners.
292+
293+
Backport of <https://github.com/ruby/ruby/pull/9652>.
294+
See: <https://github.com/ruby/ruby/pull/10980>
295+
3296
commit f1c7b6f435f1167a0514b39a5f72f55cec4d1426
4297
Author: Takashi Kokubun <[email protected]>
5298
AuthorDate: 2024-06-12 08:54:24 +0900

bootstraptest/test_yjit.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,8 @@ def foo
589589

590590
# Check that exceptions work when getting global variable
591591
assert_equal 'rescued', %q{
592+
Warning[:deprecated] = true
593+
592594
module Warning
593595
def warn(message)
594596
raise

compile.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5282,12 +5282,17 @@ compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const pre, LINK_ANCHOR *const
52825282

52835283
CHECK(COMPILE_POPPED(pre, "masgn lhs (NODE_ATTRASGN)", node));
52845284

5285+
bool safenav_call = false;
52855286
LINK_ELEMENT *insn_element = LAST_ELEMENT(pre);
52865287
iobj = (INSN *)get_prev_insn((INSN *)insn_element); /* send insn */
52875288
ASSUME(iobj);
5288-
ELEM_REMOVE(LAST_ELEMENT(pre));
5289-
ELEM_REMOVE((LINK_ELEMENT *)iobj);
5290-
pre->last = iobj->link.prev;
5289+
ELEM_REMOVE(insn_element);
5290+
if (!IS_INSN_ID(iobj, send)) {
5291+
safenav_call = true;
5292+
iobj = (INSN *)get_prev_insn(iobj);
5293+
ELEM_INSERT_NEXT(&iobj->link, insn_element);
5294+
}
5295+
(pre->last = iobj->link.prev)->next = 0;
52915296

52925297
const struct rb_callinfo *ci = (struct rb_callinfo *)OPERAND_AT(iobj, 0);
52935298
int argc = vm_ci_argc(ci) + 1;
@@ -5306,7 +5311,9 @@ compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const pre, LINK_ANCHOR *const
53065311
return COMPILE_NG;
53075312
}
53085313

5309-
ADD_ELEM(lhs, (LINK_ELEMENT *)iobj);
5314+
iobj->link.prev = lhs->last;
5315+
lhs->last->next = &iobj->link;
5316+
for (lhs->last = &iobj->link; lhs->last->next; lhs->last = lhs->last->next);
53105317
if (vm_ci_flag(ci) & VM_CALL_ARGS_SPLAT) {
53115318
int argc = vm_ci_argc(ci);
53125319
ci = ci_argc_set(iseq, ci, argc - 1);
@@ -5315,9 +5322,11 @@ compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const pre, LINK_ANCHOR *const
53155322
INSERT_BEFORE_INSN1(iobj, line_node, newarray, INT2FIX(1));
53165323
INSERT_BEFORE_INSN(iobj, line_node, concatarray);
53175324
}
5318-
ADD_INSN(lhs, line_node, pop);
5319-
if (argc != 1) {
5325+
if (!safenav_call) {
53205326
ADD_INSN(lhs, line_node, pop);
5327+
if (argc != 1) {
5328+
ADD_INSN(lhs, line_node, pop);
5329+
}
53215330
}
53225331
for (int i=0; i < argc; i++) {
53235332
ADD_INSN(post, line_node, pop);

configure

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13884,6 +13884,13 @@ then :
1388413884

1388513885
fi
1388613886

13887+
ac_fn_c_check_header_compile "$LINENO" "stdatomic.h" "ac_cv_header_stdatomic_h" "$ac_includes_default"
13888+
if test "x$ac_cv_header_stdatomic_h" = xyes
13889+
then :
13890+
printf "%s\n" "#define HAVE_STDATOMIC_H 1" >>confdefs.h
13891+
13892+
fi
13893+
1388713894

1388813895
case "$target_cpu" in #(
1388913896
x64|x86_64|i3-686*) :
@@ -26295,6 +26302,16 @@ then :
2629526302

2629626303
fi
2629726304

26305+
ac_fn_check_decl "$LINENO" "atomic_signal_fence" "ac_cv_have_decl_atomic_signal_fence" "#include <stdatomic.h>
26306+
" "$ac_c_undeclared_builtin_options" "CFLAGS"
26307+
if test "x$ac_cv_have_decl_atomic_signal_fence" = xyes
26308+
then :
26309+
ac_have_decl=1
26310+
else $as_nop
26311+
ac_have_decl=0
26312+
fi
26313+
printf "%s\n" "#define HAVE_DECL_ATOMIC_SIGNAL_FENCE $ac_have_decl" >>confdefs.h
26314+
2629826315
ac_fn_c_check_func "$LINENO" "chmod" "ac_cv_func_chmod"
2629926316
if test "x$ac_cv_func_chmod" = xyes
2630026317
then :

0 commit comments

Comments
 (0)