Skip to content

Commit 093740a

Browse files
authored
Merge pull request ruby#192 from Shopify/merge_upstream
Merge upstream Ruby Commits
2 parents d67ffb9 + e2f45b8 commit 093740a

File tree

128 files changed

+2246
-1344
lines changed

Some content is hidden

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

128 files changed

+2246
-1344
lines changed

.github/workflows/compilers.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,9 @@ jobs:
186186
- run: ./autogen.sh
187187
working-directory: src
188188
- name: Run configure
189-
run: ../src/configure -C ${default_configure} ${append_configure} --with-gcc="${default_cc} ${append_cc}"
190-
if: ${{ matrix.entry.key != 'crosshost' }}
191-
- name: Run cross configure
192-
run: ../src/configure -C ${default_configure} ${append_configure} --host="${crosshost}"
193-
if: ${{ matrix.entry.key == 'crosshost' }}
189+
run: >
190+
../src/configure -C ${default_configure} ${append_configure}
191+
${{ matrix.entry.key == 'crosshost' && '--host="${crosshost}"' || '--with-gcc="${default_cc} ${append_cc}"' }}
194192
- run: $make extract-extlibs
195193
- run: $make incs
196194
- run: $make

.github/workflows/windows.yml

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,34 @@ jobs:
44
make:
55
strategy:
66
matrix:
7-
test_task: [check] # to make job names consistent
8-
os: [windows-2019]
9-
vs: [2019]
7+
include:
8+
- vs: 2019
9+
os: windows-2019
10+
vcvars: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"'
11+
# - vs: 2022
12+
# os: windows-2022
13+
# vcvars: '"C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvars64.bat"'
1014
fail-fast: false
1115
runs-on: ${{ matrix.os }}
16+
name: VisualStudio ${{ matrix.vs }}
1217
env:
1318
GITPULLOPTIONS: --no-tags origin ${{github.ref}}
14-
VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\${{ matrix.vs }}\Enterprise\VC\Auxiliary\Build\vcvars64.bat
19+
VCVARS: ${{ matrix.vcvars }}
1520
PATCH: C:\msys64\usr\bin\patch.exe
1621
steps:
1722
- run: md build
1823
working-directory:
24+
- uses: msys2/setup-msys2@v2
25+
id: setup-msys2
26+
with:
27+
update: true
28+
install: >-
29+
patch
30+
if: ${{ matrix.os != 'windows-2019' }}
31+
- name: patch path
32+
shell: msys2 {0}
33+
run: echo PATCH=$(cygpath -wa $(command -v patch)) >> $GITHUB_ENV
34+
if: ${{ steps.setup-msys2.outcome == 'success' }}
1935
- uses: actions/cache@v2
2036
with:
2137
path: C:\vcpkg\downloads
@@ -49,43 +65,51 @@ jobs:
4965
- uses: actions/checkout@v2
5066
with:
5167
path: src
68+
- name: setup env
69+
# %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
70+
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
71+
run: |
72+
set | C:\msys64\usr\bin\sort > old.env
73+
call %VCVARS%
74+
set TMP=%USERPROFILE%\AppData\Local\Temp
75+
set TEMP=%USERPROFILE%\AppData\Local\Temp
76+
set | C:\msys64\usr\bin\sort > new.env
77+
C:\msys64\usr\bin\comm -13 old.env new.env >> %GITHUB_ENV%
78+
del *.env
5279
- name: Configure
5380
run: |
54-
call "%VCVARS%"
5581
../src/win32/configure.bat --disable-install-doc --enable-bundled-libffi --with-opt-dir=C:/vcpkg/installed/x64-windows --with-openssl-dir="C:/Program Files/OpenSSL-Win64"
5682
- name: nmake
5783
run: |
58-
call "%VCVARS%"
59-
set YACC=win_bison
60-
echo on
84+
echo ^#^#[group]incs
6185
nmake incs
86+
echo ^#^#[endgroup]
87+
echo ^#^#[group]extract-extlibs
6288
nmake extract-extlibs
89+
echo ^#^#[endgroup]
6390
nmake
91+
env:
92+
YACC: win_bison
6493
- name: nmake test
6594
timeout-minutes: 5
6695
run: |
67-
call "%VCVARS%"
6896
nmake test
6997
- name: nmake test-all
7098
timeout-minutes: 60
7199
run: |
72-
call "%VCVARS%"
73-
::- %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
74-
::- https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
75-
set TMP=%USERPROFILE%\AppData\Local\Temp
76-
set TEMP=%USERPROFILE%\AppData\Local\Temp
77-
nmake test-all
100+
nmake test-all TESTOPTS="-j%NUMBER_OF_PROCESSORS% --job-status=normal"
101+
continue-on-error: ${{ matrix.continue-on-error || false }}
78102
- name: nmake test-spec
79103
timeout-minutes: 10
80104
run: |
81-
call "%VCVARS%"
82105
nmake test-spec
106+
continue-on-error: ${{ matrix.continue-on-error || false }}
83107
- uses: k0kubun/action-slack@v2.0.0
84108
with:
85109
payload: |
86110
{
87111
"ci": "GitHub Actions",
88-
"env": "${{ matrix.os }} / ${{ matrix.test_task }}",
112+
"env": "VS${{ matrix.vs }} / ${{ matrix.test_task || 'check' }}",
89113
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
90114
"commit": "${{ github.sha }}",
91115
"branch": "${{ github.ref }}".split('/').reverse()[0]

LEGAL

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,7 @@ mentioned below.
532532
[missing/acosh.c]
533533
[missing/alloca.c]
534534
[missing/erf.c]
535-
[missing/finite.c]
536535
[missing/hypot.c]
537-
[missing/isinf.c]
538-
[missing/isnan.c]
539536
[missing/lgamma_r.c]
540537
[missing/memcmp.c]
541538
[missing/memmove.c]

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ Excluding feature bug fixes.
227227
[Bug #18003]: https://bugs.ruby-lang.org/issues/18003
228228
[Feature #17370]: https://bugs.ruby-lang.org/issues/17370
229229
[Feature #17470]: https://bugs.ruby-lang.org/issues/17470
230+
[Feature #17750]: https://bugs.ruby-lang.org/issues/17750
230231
[Feature #17853]: https://bugs.ruby-lang.org/issues/17853
231232
[Bug #17827]: https://bugs.ruby-lang.org/issues/17827
232233
[Feature #18008]: https://bugs.ruby-lang.org/issues/18008
233234
[Feature #18015]: https://bugs.ruby-lang.org/issues/18015
235+
[Feature #18029]: https://bugs.ruby-lang.org/issues/18029

array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4096,7 +4096,7 @@ ary_slice_bang_by_rb_ary_splice(VALUE ary, long pos, long len)
40964096
else if (orig_len < pos) {
40974097
return Qnil;
40984098
}
4099-
else if (orig_len < pos + len) {
4099+
if (orig_len < pos + len) {
41004100
len = orig_len - pos;
41014101
}
41024102
if (len == 0) {

ast.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ ast_new_internal(rb_ast_t *ast, const NODE *node)
6464
return obj;
6565
}
6666

67-
static VALUE rb_ast_parse_str(VALUE str, VALUE save_script_lines);
68-
static VALUE rb_ast_parse_file(VALUE path, VALUE save_script_lines);
67+
static VALUE rb_ast_parse_str(VALUE str, VALUE keep_script_lines);
68+
static VALUE rb_ast_parse_file(VALUE path, VALUE keep_script_lines);
6969

7070
static VALUE
7171
ast_parse_new(void)
@@ -85,31 +85,31 @@ ast_parse_done(rb_ast_t *ast)
8585
}
8686

8787
static VALUE
88-
ast_s_parse(rb_execution_context_t *ec, VALUE module, VALUE str, VALUE save_script_lines)
88+
ast_s_parse(rb_execution_context_t *ec, VALUE module, VALUE str, VALUE keep_script_lines)
8989
{
90-
return rb_ast_parse_str(str, save_script_lines);
90+
return rb_ast_parse_str(str, keep_script_lines);
9191
}
9292

9393
static VALUE
94-
rb_ast_parse_str(VALUE str, VALUE save_script_lines)
94+
rb_ast_parse_str(VALUE str, VALUE keep_script_lines)
9595
{
9696
rb_ast_t *ast = 0;
9797

9898
StringValue(str);
9999
VALUE vparser = ast_parse_new();
100-
if (RTEST(save_script_lines)) rb_parser_save_script_lines(vparser);
100+
if (RTEST(keep_script_lines)) rb_parser_keep_script_lines(vparser);
101101
ast = rb_parser_compile_string_path(vparser, Qnil, str, 1);
102102
return ast_parse_done(ast);
103103
}
104104

105105
static VALUE
106-
ast_s_parse_file(rb_execution_context_t *ec, VALUE module, VALUE path, VALUE save_script_lines)
106+
ast_s_parse_file(rb_execution_context_t *ec, VALUE module, VALUE path, VALUE keep_script_lines)
107107
{
108-
return rb_ast_parse_file(path, save_script_lines);
108+
return rb_ast_parse_file(path, keep_script_lines);
109109
}
110110

111111
static VALUE
112-
rb_ast_parse_file(VALUE path, VALUE save_script_lines)
112+
rb_ast_parse_file(VALUE path, VALUE keep_script_lines)
113113
{
114114
VALUE f;
115115
rb_ast_t *ast = 0;
@@ -119,7 +119,7 @@ rb_ast_parse_file(VALUE path, VALUE save_script_lines)
119119
f = rb_file_open_str(path, "r");
120120
rb_funcall(f, rb_intern("set_encoding"), 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
121121
VALUE vparser = ast_parse_new();
122-
if (RTEST(save_script_lines)) rb_parser_save_script_lines(vparser);
122+
if (RTEST(keep_script_lines)) rb_parser_keep_script_lines(vparser);
123123
ast = rb_parser_compile_file_path(vparser, Qnil, f, 1);
124124
rb_io_close(f);
125125
return ast_parse_done(ast);
@@ -139,13 +139,13 @@ lex_array(VALUE array, int index)
139139
}
140140

141141
static VALUE
142-
rb_ast_parse_array(VALUE array, VALUE save_script_lines)
142+
rb_ast_parse_array(VALUE array, VALUE keep_script_lines)
143143
{
144144
rb_ast_t *ast = 0;
145145

146146
array = rb_check_array_type(array);
147147
VALUE vparser = ast_parse_new();
148-
if (RTEST(save_script_lines)) rb_parser_save_script_lines(vparser);
148+
if (RTEST(keep_script_lines)) rb_parser_keep_script_lines(vparser);
149149
ast = rb_parser_compile_generic(vparser, lex_array, Qnil, array, 1);
150150
return ast_parse_done(ast);
151151
}
@@ -193,7 +193,7 @@ script_lines(VALUE path)
193193
}
194194

195195
static VALUE
196-
ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE save_script_lines)
196+
ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE keep_script_lines)
197197
{
198198
VALUE path, node, lines;
199199
int node_id;
@@ -221,13 +221,13 @@ ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE save_script
221221
}
222222

223223
if (!NIL_P(lines = script_lines(path))) {
224-
node = rb_ast_parse_array(lines, save_script_lines);
224+
node = rb_ast_parse_array(lines, keep_script_lines);
225225
}
226226
else if (RSTRING_LEN(path) == 2 && memcmp(RSTRING_PTR(path), "-e", 2) == 0) {
227-
node = rb_ast_parse_str(rb_e_script, save_script_lines);
227+
node = rb_ast_parse_str(rb_e_script, keep_script_lines);
228228
}
229229
else {
230-
node = rb_ast_parse_file(path, save_script_lines);
230+
node = rb_ast_parse_file(path, keep_script_lines);
231231
}
232232

233233
return node_find(node, node_id);

ast.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ module RubyVM::AbstractSyntaxTree
2929
#
3030
# RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
3131
# # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:9>
32-
def self.parse string, save_script_lines: false
33-
Primitive.ast_s_parse string, save_script_lines
32+
def self.parse string, keep_script_lines: false
33+
Primitive.ast_s_parse string, keep_script_lines
3434
end
3535

3636
# call-seq:
@@ -44,8 +44,8 @@ def self.parse string, save_script_lines: false
4444
#
4545
# RubyVM::AbstractSyntaxTree.parse_file("my-app/app.rb")
4646
# # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-31:3>
47-
def self.parse_file pathname, save_script_lines: false
48-
Primitive.ast_s_parse_file pathname, save_script_lines
47+
def self.parse_file pathname, keep_script_lines: false
48+
Primitive.ast_s_parse_file pathname, keep_script_lines
4949
end
5050

5151
# call-seq:
@@ -63,8 +63,8 @@ def self.parse_file pathname, save_script_lines: false
6363
#
6464
# RubyVM::AbstractSyntaxTree.of(method(:hello))
6565
# # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-3:3>
66-
def self.of body, save_script_lines: false
67-
Primitive.ast_s_of body, save_script_lines
66+
def self.of body, keep_script_lines: false
67+
Primitive.ast_s_of body, keep_script_lines
6868
end
6969

7070
# RubyVM::AbstractSyntaxTree::Node instances are created by parse methods in

benchmark/attr_accessor.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
prelude: |
2+
class C
3+
attr_accessor :x
4+
def initialize
5+
@x = nil
6+
end
7+
class_eval <<-END
8+
def ar
9+
#{'x;'*256}
10+
end
11+
def aw
12+
#{'self.x = nil;'*256}
13+
end
14+
def arm
15+
m = method(:x)
16+
#{'m.call;'*256}
17+
end
18+
def awm
19+
m = method(:x=)
20+
#{'m.call(nil);'*256}
21+
end
22+
END
23+
end
24+
obj = C.new
25+
benchmark:
26+
attr_reader: "obj.ar"
27+
attr_writer: "obj.aw"
28+
attr_reader_method: "obj.arm"
29+
attr_writer_method: "obj.awm"

bignum.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "internal/numeric.h"
3737
#include "internal/object.h"
3838
#include "internal/sanitizers.h"
39-
#include "internal/util.h"
4039
#include "internal/variable.h"
4140
#include "internal/warnings.h"
4241
#include "ruby/thread.h"
@@ -5383,7 +5382,7 @@ rb_integer_float_eq(VALUE x, VALUE y)
53835382
double yd = RFLOAT_VALUE(y);
53845383
double yi, yf;
53855384

5386-
if (isnan(yd) || isinf(yd))
5385+
if (!isfinite(yd))
53875386
return Qfalse;
53885387
yf = modf(yd, &yi);
53895388
if (yf != 0)

bootstraptest/test_ractor.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,4 +1418,19 @@ class C
14181418
'ok'
14191419
}
14201420

1421+
# Can yield back values while GC is sweeping [Bug #18117]
1422+
assert_equal "ok", %q{
1423+
workers = (0...8).map do
1424+
Ractor.new do
1425+
loop do
1426+
10_000.times.map { Object.new }
1427+
Ractor.yield Time.now
1428+
end
1429+
end
1430+
end
1431+
1432+
1_000.times { idle_worker, tmp_reporter = Ractor.select(*workers) }
1433+
"ok"
1434+
}
1435+
14211436
end # if !ENV['GITHUB_WORKFLOW']

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy