Skip to content

Commit 5731380

Browse files
authored
Merge branch 'main' into getspecial
2 parents c1e9245 + 1701214 commit 5731380

File tree

563 files changed

+30263
-5357
lines changed

Some content is hidden

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

563 files changed

+30263
-5357
lines changed

.github/workflows/baseruby.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
# - ruby-2.5
1616
# - ruby-2.6
1717
- ruby-2.7
18+
- ruby-3.0
1819

1920
steps:
2021
- uses: actions/checkout@v2

.github/workflows/bundled_gems.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: bundled_gems
2+
3+
on:
4+
schedule:
5+
- cron: '45 6 * * *'
6+
7+
jobs:
8+
update:
9+
if: ${{ github.repository == 'ruby/ruby' }}
10+
name: update ${{ github.workflow }}
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: git config
14+
run: |
15+
git config --global advice.detachedHead 0
16+
git config --global init.defaultBranch garbage
17+
18+
- name: Set ENV
19+
run: |
20+
echo "JOBS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
21+
22+
- uses: actions/checkout@v2
23+
24+
- name: Update ${{ github.workflow }}
25+
run: |
26+
ruby -i~ tool/update-bundled_gems.rb gems/${{ github.workflow }}
27+
28+
- name: Check diffs
29+
id: diff
30+
run: |
31+
git diff --no-ext-diff --ignore-submodules --exit-code
32+
continue-on-error: true
33+
34+
- name: Install libraries
35+
run: |
36+
set -x
37+
sudo apt-get update -q || :
38+
sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev bison autoconf ruby
39+
if: ${{ steps.diff.outcome == 'failure' }}
40+
41+
- name: Build
42+
run: |
43+
./autogen.sh
44+
./configure -C --disable-install-doc
45+
make $JOBS
46+
if: ${{ steps.diff.outcome == 'failure' }}
47+
48+
- name: Test bundled gems
49+
run: |
50+
make $JOBS -s test-bundled-gems
51+
timeout-minutes: 30
52+
env:
53+
RUBY_TESTOPTS: "-q --tty=no"
54+
TEST_BUNDLED_GEMS_ALLOW_FAILURES: ""
55+
if: ${{ steps.diff.outcome == 'failure' }}
56+
57+
- name: Commit
58+
run: |
59+
git commit --message="Update ${{ github.workflow }} at $(date +%F)" gems/${{ github.workflow }}
60+
git pull --ff-only origin ${GITHUB_REF#refs/heads/}
61+
git push origin ${GITHUB_REF#refs/heads/}
62+
env:
63+
EMAIL: svn-admin@ruby-lang.org
64+
GIT_AUTHOR_NAME: git
65+
GIT_COMMITTER_NAME: git
66+
if: ${{ steps.diff.outcome == 'failure' }}

.github/workflows/compilers.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
name: 'gcc-11 LTO'
6060
value: 'gcc-11 -O2 -flto=auto -ffat-lto-objects'
6161
container: gcc-11
62+
shared: '--disable-shared'
6263
# check: true
6364
- { key: default_cc, name: clang-14, value: clang-14, container: clang-14 }
6465
- { key: default_cc, name: clang-13, value: clang-13, container: clang-13 }
@@ -76,6 +77,7 @@ jobs:
7677
name: 'clang-14 LTO'
7778
value: 'clang-14 -O2 -flto=auto'
7879
container: clang-14
80+
shared: '--disable-shared'
7981
# check: true
8082

8183
- { key: crosshost, name: aarch64-linux-gnu, value: aarch64-linux-gnu, container: crossbuild-essential-arm64 }
@@ -189,6 +191,7 @@ jobs:
189191
run: >
190192
../src/configure -C ${default_configure} ${append_configure}
191193
${{ matrix.entry.key == 'crosshost' && '--host="${crosshost}"' || '--with-gcc="${default_cc} ${append_cc}"' }}
194+
${{ matrix.entry.shared || '--enable-shared' }}
192195
- run: $make extract-extlibs
193196
- run: $make incs
194197
- run: $make

addr2line.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
21872187
#endif
21882188

21892189
#define HAVE_MAIN_EXE_PATH
2190-
#if defined(__FreeBSD__)
2190+
#if defined(__FreeBSD__) || defined(__DragonFly__)
21912191
# include <sys/sysctl.h>
21922192
#endif
21932193
/* ssize_t main_exe_path(void)
@@ -2210,7 +2210,7 @@ main_exe_path(void)
22102210
binary_filename[len] = 0;
22112211
return len;
22122212
}
2213-
#elif defined(__FreeBSD__)
2213+
#elif defined(__FreeBSD__) || defined(__DragonFly__)
22142214
static ssize_t
22152215
main_exe_path(void)
22162216
{

array.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,14 +2234,6 @@ rb_ary_set_len(VALUE ary, long len)
22342234
ARY_SET_LEN(ary, len);
22352235
}
22362236

2237-
/*!
2238-
* expands or shrinks \a ary to \a len elements.
2239-
* expanded region will be filled with Qnil.
2240-
* \param ary an array
2241-
* \param len new size
2242-
* \return \a ary
2243-
* \post the size of \a ary is \a len.
2244-
*/
22452237
VALUE
22462238
rb_ary_resize(VALUE ary, long len)
22472239
{
@@ -4845,6 +4837,7 @@ ary_append(VALUE x, VALUE y)
48454837
if (n > 0) {
48464838
rb_ary_splice(x, RARRAY_LEN(x), 0, RARRAY_CONST_PTR_TRANSIENT(y), n);
48474839
}
4840+
RB_GC_GUARD(y);
48484841
return x;
48494842
}
48504843

@@ -5921,8 +5914,7 @@ ary_min_opt_string(VALUE ary, long i, VALUE vmin)
59215914
*
59225915
* With an argument +n+ and a block, returns a new \Array with at most +n+ elements,
59235916
* in ascending order per the block:
5924-
* [0, 1, 2, 3].min(3) # => [0, 1, 2]
5925-
* [0, 1, 2, 3].min(6) # => [0, 1, 2, 3]
5917+
* ['0', '00', '000'].min(2) {|a, b| a.size <=> b.size } # => ["0", "00"]
59265918
*/
59275919
static VALUE
59285920
rb_ary_min(int argc, VALUE *argv, VALUE ary)

ast.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ node_children(rb_ast_t *ast, const NODE *node)
366366
case NODE_WHILE:
367367
case NODE_UNTIL:
368368
return rb_ary_push(rb_ary_new_from_node_args(ast, 2, node->nd_cond, node->nd_body),
369-
(node->nd_state ? Qtrue : Qfalse));
369+
RBOOL(node->nd_state));
370370
case NODE_ITER:
371371
case NODE_FOR:
372372
return rb_ary_new_from_node_args(ast, 2, node->nd_iter, node->nd_body);
@@ -433,7 +433,7 @@ node_children(rb_ast_t *ast, const NODE *node)
433433
NEW_CHILD(ast, node->nd_args->nd_body));
434434
case NODE_OP_ASGN2:
435435
return rb_ary_new_from_args(5, NEW_CHILD(ast, node->nd_recv),
436-
node->nd_next->nd_aid ? Qtrue : Qfalse,
436+
RBOOL(node->nd_next->nd_aid),
437437
ID2SYM(node->nd_next->nd_vid),
438438
ID2SYM(node->nd_next->nd_mid),
439439
NEW_CHILD(ast, node->nd_value));

bignum.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5471,10 +5471,10 @@ big_op(VALUE x, VALUE y, enum big_op_t op)
54715471
n = FIX2INT(rel);
54725472

54735473
switch (op) {
5474-
case big_op_gt: return n > 0 ? Qtrue : Qfalse;
5475-
case big_op_ge: return n >= 0 ? Qtrue : Qfalse;
5476-
case big_op_lt: return n < 0 ? Qtrue : Qfalse;
5477-
case big_op_le: return n <= 0 ? Qtrue : Qfalse;
5474+
case big_op_gt: return RBOOL(n > 0);
5475+
case big_op_ge: return RBOOL(n >= 0);
5476+
case big_op_lt: return RBOOL(n < 0);
5477+
case big_op_le: return RBOOL(n <= 0);
54785478
}
54795479
return Qundef;
54805480
}
@@ -5518,7 +5518,7 @@ VALUE
55185518
rb_big_eq(VALUE x, VALUE y)
55195519
{
55205520
if (FIXNUM_P(y)) {
5521-
return bignorm(x) == y ? Qtrue : Qfalse;
5521+
return RBOOL(bignorm(x) == y);
55225522
}
55235523
else if (RB_BIGNUM_TYPE_P(y)) {
55245524
}

bootstraptest/test_yjit.rb

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
# Check that frozen objects are respected
2+
assert_equal 'great', %q{
3+
class Foo
4+
attr_accessor :bar
5+
def initialize
6+
@bar = 1
7+
freeze
8+
end
9+
end
10+
11+
foo = Foo.new
12+
13+
5.times do
14+
begin
15+
foo.bar = 2
16+
rescue FrozenError
17+
end
18+
end
19+
20+
foo.bar == 1 ? "great" : "NG"
21+
}
22+
123
# Check that global variable set works
224
assert_equal 'string', %q{
325
def foo
@@ -1943,14 +1965,34 @@ def eq(a, b)
19431965
]
19441966
}
19451967

1946-
# Redefined eq
1968+
# Redefined String eq
19471969
assert_equal 'true', %q{
19481970
class String
19491971
def ==(other)
19501972
true
19511973
end
19521974
end
19531975
1954-
"foo" == "bar"
1955-
"foo" == "bar"
1976+
def eq(a, b)
1977+
a == b
1978+
end
1979+
1980+
eq("foo", "bar")
1981+
eq("foo", "bar")
1982+
}
1983+
1984+
# Redefined Integer eq
1985+
assert_equal 'true', %q{
1986+
class Integer
1987+
def ==(other)
1988+
true
1989+
end
1990+
end
1991+
1992+
def eq(a, b)
1993+
a == b
1994+
end
1995+
1996+
eq(1, 2)
1997+
eq(1, 2)
19561998
}

0 commit comments

Comments
 (0)