Skip to content

Commit 8d88af1

Browse files
authored
Merge pull request #114 from Shopify/merge_upstream
Merge upstream Ruby
2 parents 77654f2 + cae3595 commit 8d88af1

File tree

99 files changed

+22853
-7586
lines changed

Some content is hidden

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

99 files changed

+22853
-7586
lines changed

addr2line.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,7 @@ debug_info_read(DebugInfoReader *reader, int num_traces, void **traces,
16991699
static unsigned long
17001700
uncompress_debug_section(ElfW(Shdr) *shdr, char *file, char **ptr)
17011701
{
1702+
*ptr = NULL;
17021703
#ifdef SUPPORT_COMPRESSED_DEBUG_LINE
17031704
ElfW(Chdr) *chdr = (ElfW(Chdr) *)(file + shdr->sh_offset);
17041705
unsigned long destsize = chdr->ch_size;
@@ -1719,6 +1720,7 @@ uncompress_debug_section(ElfW(Shdr) *shdr, char *file, char **ptr)
17191720

17201721
fail:
17211722
free(*ptr);
1723+
*ptr = NULL;
17221724
#endif
17231725
return 0;
17241726
}

benchmark/vm_thread_condvar1.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# two threads, two mutex, two condvar ping-pong
22
require 'thread'
3-
m1 = Mutex.new
4-
m2 = Mutex.new
5-
cv1 = ConditionVariable.new
6-
cv2 = ConditionVariable.new
3+
m1 = Thread::Mutex.new
4+
m2 = Thread::Mutex.new
5+
cv1 = Thread::ConditionVariable.new
6+
cv2 = Thread::ConditionVariable.new
77
max = 100000
88
i = 0
99
wait = nil

benchmark/vm_thread_condvar2.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# many threads, one mutex, many condvars
22
require 'thread'
3-
m = Mutex.new
4-
cv1 = ConditionVariable.new
5-
cv2 = ConditionVariable.new
3+
m = Thread::Mutex.new
4+
cv1 = Thread::ConditionVariable.new
5+
cv2 = Thread::ConditionVariable.new
66
max = 1000
77
n = 100
88
waiting = 0
99
scvs = []
1010
waiters = n.times.map do |i|
11-
start_cv = ConditionVariable.new
11+
start_cv = Thread::ConditionVariable.new
1212
scvs << start_cv
13-
start_mtx = Mutex.new
13+
start_mtx = Thread::Mutex.new
1414
start_mtx.synchronize do
1515
th = Thread.new(start_mtx, start_cv) do |sm, scv|
1616
m.synchronize do

bootstraptest/test_insns.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class X; def x; {}; end; end
384384
[ 'opt_empty_p', %q{ ''.empty? }, ],
385385
[ 'opt_empty_p', %q{ [].empty? }, ],
386386
[ 'opt_empty_p', %q{ {}.empty? }, ],
387-
[ 'opt_empty_p', %q{ Queue.new.empty? }, ],
387+
[ 'opt_empty_p', %q{ Thread::Queue.new.empty? }, ],
388388

389389
[ 'opt_succ', %q{ 1.succ == 2 }, ],
390390
if defined? $FIXNUM_MAX then

bootstraptest/test_ractor.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ def test n
533533
# threads in a ractor will killed
534534
assert_equal '{:ok=>3}', %q{
535535
Ractor.new Ractor.current do |main|
536-
q = Queue.new
536+
q = Thread::Queue.new
537537
Thread.new do
538538
q << true
539539
loop{}
@@ -1405,4 +1405,17 @@ class C
14051405
end
14061406
}
14071407

1408+
assert_equal "ok", %q{
1409+
GC.disable
1410+
Ractor.new {}
1411+
raise "not ok" unless GC.disable
1412+
1413+
foo = []
1414+
10.times { foo << 1 }
1415+
1416+
GC.start
1417+
1418+
'ok'
1419+
}
1420+
14081421
end # if !ENV['GITHUB_WORKFLOW']

common.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ what-where-nodoc: no-install-nodoc
477477
no-install-nodoc: pre-no-install-nodoc dont-install-nodoc post-no-install-nodoc
478478
pre-no-install-nodoc:: pre-no-install-local pre-no-install-ext
479479
dont-install-nodoc: $(PREP)
480-
$(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS)
480+
$(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --exclude=doc
481481
post-no-install-nodoc:: post-no-install-local post-no-install-ext
482482

483483
what-where-local: no-install-local

compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3101,6 +3101,7 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
31013101
*/
31023102
int stop_optimization =
31033103
ISEQ_COVERAGE(iseq) && ISEQ_LINE_COVERAGE(iseq) &&
3104+
nobj->link.type == ISEQ_ELEMENT_INSN &&
31043105
nobj->insn_info.events;
31053106
if (!stop_optimization) {
31063107
INSN *pobj = (INSN *)iobj->link.prev;

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,8 @@ AS_CASE(["$target_os"], [*android*], [
962962
AS_UNSET(ORIG_LIBS)
963963
POSTLINK=:
964964
AC_SUBST(POSTLINK)
965+
cleanlibs=
966+
AC_SUBST(cleanlibs)
965967
AS_CASE(["$target_os"],
966968
[nextstep*], [ ],
967969
[openstep*], [ ],
@@ -1060,6 +1062,7 @@ main()
10601062
AC_CHECK_HEADERS(crt_externs.h, [], [], [
10611063
#include <crt_externs.h>
10621064
])
1065+
cleanlibs='$(TARGET_SO).dSYM'
10631066
],
10641067
[hpux*], [ LIBS="-lm $LIBS"
10651068
ac_cv_c_inline=no],

dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2955,7 +2955,7 @@ static VALUE
29552955
dir_s_glob(rb_execution_context_t *ec, VALUE obj, VALUE str, VALUE rflags, VALUE base, VALUE sort)
29562956
{
29572957
VALUE ary = rb_check_array_type(str);
2958-
const int flags = NUM2INT(rflags) | dir_glob_option_sort(sort);
2958+
const int flags = (NUM2INT(rflags) | dir_glob_option_sort(sort)) & ~FNM_CASEFOLD;
29592959
base = dir_glob_option_base(base);
29602960
if (NIL_P(ary)) {
29612961
ary = rb_push_glob(str, base, flags);

error.c

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -484,34 +484,51 @@ rb_enc_warning(rb_encoding *enc, const char *fmt, ...)
484484
}
485485
#endif
486486

487+
static bool
488+
deprecation_warning_enabled(void)
489+
{
490+
if (NIL_P(ruby_verbose)) return false;
491+
if (!rb_warning_category_enabled_p(RB_WARN_CATEGORY_DEPRECATED)) return false;
492+
return true;
493+
}
494+
495+
static void
496+
warn_deprecated(VALUE mesg, const char *removal, const char *suggest)
497+
{
498+
rb_str_set_len(mesg, RSTRING_LEN(mesg) - 1);
499+
rb_str_cat_cstr(mesg, " is deprecated");
500+
if (removal) {
501+
rb_str_catf(mesg, " and will be removed in Ruby %s", removal);
502+
}
503+
if (suggest) rb_str_catf(mesg, "; use %s instead", suggest);
504+
rb_str_cat_cstr(mesg, "\n");
505+
rb_warn_category(mesg, ID2SYM(id_deprecated));
506+
}
507+
487508
void
488509
rb_warn_deprecated(const char *fmt, const char *suggest, ...)
489510
{
490-
if (NIL_P(ruby_verbose)) return;
491-
if (!rb_warning_category_enabled_p(RB_WARN_CATEGORY_DEPRECATED)) return;
511+
if (!deprecation_warning_enabled()) return;
512+
492513
va_list args;
493514
va_start(args, suggest);
494515
VALUE mesg = warning_string(0, fmt, args);
495516
va_end(args);
496-
rb_str_set_len(mesg, RSTRING_LEN(mesg) - 1);
497-
rb_str_cat_cstr(mesg, " is deprecated");
498-
if (suggest) rb_str_catf(mesg, "; use %s instead", suggest);
499-
rb_str_cat_cstr(mesg, "\n");
500-
rb_warn_category(mesg, ID2SYM(id_deprecated));
517+
518+
warn_deprecated(mesg, NULL, suggest);
501519
}
502520

503521
void
504-
rb_warn_deprecated_to_remove(const char *fmt, const char *removal, ...)
522+
rb_warn_deprecated_to_remove(const char *removal, const char *fmt, const char *suggest, ...)
505523
{
506-
if (NIL_P(ruby_verbose)) return;
507-
if (!rb_warning_category_enabled_p(RB_WARN_CATEGORY_DEPRECATED)) return;
524+
if (!deprecation_warning_enabled()) return;
525+
508526
va_list args;
509-
va_start(args, removal);
527+
va_start(args, suggest);
510528
VALUE mesg = warning_string(0, fmt, args);
511529
va_end(args);
512-
rb_str_set_len(mesg, RSTRING_LEN(mesg) - 1);
513-
rb_str_catf(mesg, " is deprecated and will be removed in Ruby %s\n", removal);
514-
rb_warn_category(mesg, ID2SYM(id_deprecated));
530+
531+
warn_deprecated(mesg, removal, suggest);
515532
}
516533

517534
static inline int
@@ -3296,14 +3313,14 @@ rb_check_frozen(VALUE obj)
32963313
void
32973314
rb_error_untrusted(VALUE obj)
32983315
{
3299-
rb_warn_deprecated_to_remove("rb_error_untrusted", "3.2");
3316+
rb_warn_deprecated_to_remove_at(3.2, "rb_error_untrusted", NULL);
33003317
}
33013318

33023319
#undef rb_check_trusted
33033320
void
33043321
rb_check_trusted(VALUE obj)
33053322
{
3306-
rb_warn_deprecated_to_remove("rb_check_trusted", "3.2");
3323+
rb_warn_deprecated_to_remove_at(3.2, "rb_check_trusted", NULL);
33073324
}
33083325

33093326
void

0 commit comments

Comments
 (0)