8000 Merge pull request #35 from mmtk/merge-from-upstream · wks/ruby@afd2c1f · GitHub
[go: up one dir, main page]

Skip to content

Commit afd2c1f

Browse files
authored
Merge pull request ruby#35 from mmtk/merge-from-upstream
Merge from upstream
2 parents 434ea8e + ffdd02e commit afd2c1f

File tree

148 files changed

+1946
-1332
lines changed

Some content is hidden

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

148 files changed

+1946
-1332
lines changed

.document

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ nilclass.rb
2323
pack.rb
2424
ractor.rb
2525
string.rb
26+
symbol.rb
2627
timev.rb
2728
thread_sync.rb
2829
trace_point.rb

.github/workflows/mjit-bindgen.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ jobs:
2828
include:
2929
- task: mjit-bindgen
3030
fail-fast: false
31-
env:
32-
SETARCH: ${{ matrix.arch && format('setarch {0}', matrix.arch) }}
3331
runs-on: ubuntu-20.04
3432
if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }}
3533
steps:
@@ -39,20 +37,20 @@ jobs:
3937
run: |
4038
echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
4139
- name: Install libraries
42-
env:
43-
arch: ${{ matrix.arch }}
4440
run: |
4541
set -x
46-
arch=${arch:+:${arch/i[3-6]86/i386}}
47-
${arch:+sudo dpkg --add-architecture ${arch#:}}
4842
sudo apt-get update -q || :
4943
sudo apt-get install --no-install-recommends -q -y \
50-
${arch:+cross}build-essential${arch/:/-} \
51-
libssl-dev${arch} libyaml-dev${arch} libreadline6-dev${arch} \
52-
zlib1g-dev${arch} libncurses5-dev${arch} libffi-dev${arch} \
53-
libclang1-10${arch} \
54-
bison autoconf ruby
55-
sudo apt-get install -q -y pkg-config${arch} || :
44+
build-essential \
45+
libssl-dev libyaml-dev libreadline6-dev \
46+
zlib1g-dev libncurses5-dev libffi-dev \
47+
libclang1-10 \
48+
bison autoconf
49+
sudo apt-get install -q -y pkg-config || :
50+
- name: Set up Ruby
51+
uses: ruby/setup-ruby@v1
52+
with:
53+
ruby-version: '3.1'
5654
- name: git config
5755
run: |
5856
git config --global advice.detachedHead 0
@@ -72,15 +70,11 @@ jobs:
7270
- run: ./autogen.sh
7371
working-directory: src
7472
- name: Run configure
75-
env:
76-
arch: ${{ matrix.arch }}
77-
run: >-
78-
$SETARCH ../src/configure -C --disable-install-doc --prefix=$(pwd)/install --enable-yjit=dev_nodebug
79-
${arch:+--target=$arch-$OSTYPE --host=$arch-$OSTYPE}
80-
- run: $SETARCH make incs
81-
- run: $SETARCH make
82-
- run: $SETARCH make install
83-
- run: $SETARCH make ${{ matrix.task }}
73+
run: ../src/configure -C --disable-install-doc --prefix=$(pwd)/install --enable-yjit=dev_nodebug
74+
- run: make incs
75+
- run: make
76+
- run: make install
77+
- run: make ${{ matrix.task }}
8478
- run: git diff --exit-code
8579
working-directory: src
8680
- uses: ruby/action-slack@v3.0.0

NEWS.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ Note that each entry is kept to a minimum, see links for details.
103103
Note: We're only listing outstanding class updates.
104104
105105
* Fiber::Scheduler
106-
* Introduce `Fiber::Scheduler#io_select` for non-blocking `IO.select`. [[Feature #19060]]
106+
* Introduce `Fiber::Scheduler#io_select` for non-blocking `IO.select`.
107+
[[Feature #19060]]
107108
108109
* IO
109110
* Introduce `IO#timeout=` and `IO#timeout` which can cause
@@ -115,6 +116,11 @@ Note: We're only listing outstanding class updates.
115116
STDIN.read # => Blocking operation timed out! (IO::TimeoutError)
116117
```
117118
119+
* UNIXSocket
120+
* Add support for `UNIXSocket` on Windows. Emulate anonymous sockets. Add
121+
support for `File.socket?` and `File::Stat#socket?` where possible.
122+
[[Feature #19135]]
123+
118124
* Class
119125
* `Class#attached_object`, which returns the object for which
120126
the receiver is the singleton class. Raises `TypeError` if the
@@ -239,7 +245,7 @@ Note: We're only listing outstanding class updates.
239245
* io-nonblock 0.1.1
240246
* io-wait 0.3.0.pre
241247
* ipaddr 1.2.4
242-
* irb 1.4.2
248+
* irb 1.4.3
243249
* json 2.6.2
244250
* logger 1.5.1
245251
* net-http 0.3.0
@@ -301,7 +307,22 @@ The following deprecated methods are removed.
301307
* `Psych` no longer bundles libyaml sources.
302308
And also `Fiddle` no longer bundles libffi sources.
303309
Users need to install the libyaml/libffi library themselves via the package
304-
system. [[Feature #18571]]
310+
manager like apt, yum, brew, etc.
311+
312+
Psych and fiddle supported the static build with specific version of libyaml
313+
and libffi sources. You can build psych with libyaml-0.2.5 like this.
314+
315+
```bash
316+
$ ./configure --with-libyaml-source-dir=/path/to/libyaml-0.2.5
317+
```
318+
319+
And you can build fiddle with libffi-3.4.4 like this.
320+
321+
```bash
322+
$ ./configure --with-libffi-source-dir=/path/to/libffi-3.4.4
323+
```
324+
325+
[[Feature #18571]]
305326

306327
## C API updates
307328

@@ -356,6 +377,7 @@ The following deprecated APIs are removed.
356377
doing it in a native thread called MJIT worker. [[Feature #18968]]
357378
* As a result, Microsoft Visual Studio (MSWIN) is no longer supported.
358379
* MinGW is no longer supported. [[Feature #18824]]
380+
* Rename `--mjit-min-calls` to `--mjit-call-threshold`.
359381

360382
## Static analysis
361383

@@ -416,3 +438,4 @@ The following deprecated APIs are removed.
416438
[Feature #19026]: https://bugs.ruby-lang.org/issues/19026
417439
[Feature #19060]: https://bugs.ruby-lang.org/issues/19060
418440
[Bug #19100]: https://bugs.ruby-lang.org/issues/19100
441+
[Feature #19135]: https://bugs.ruby-lang.org/issues/19135

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,50 @@ see [Building Ruby](doc/contributing/building_ruby.md)
5454

5555
https://www.ruby-lang.org/
5656

57+
## Commands
58+
59+
The following commands are available on IRB.
60+
61+
* `cwws`
62+
* Show the current workspace.
63+
* `cb`, `cws`, `chws`
64+
* Change the current workspace to an object.
65+
* `bindings`, `workspaces`
66+
* Show workspaces.
67+
* `pushb`, `pushws`
68+
* Push an object to the workspace stack.
69+
* `popb`, `popws`
70+
* Pop a workspace from the workspace stack.
71+
* `load`
72+
* Load a Ruby file.
73+
* `require`
74+
* Require a Ruby file.
75+
* `source`
76+
* Loads a given file in the current session.
77+
* `irb`
78+
* Start a child IRB.
79+
* `jobs`
80+
* List of current sessions.
81+
* `fg`
82+
* Switches to the session of the given number.
83+
* `kill`
84+
* Kills the session with the given number.
85+
* `help`
86+
* Enter the mode to look up RI documents.
87+
* `irb_info`
88+
* Show information about IRB.
89+
* `ls`
90+
* Show methods, constants, and variables.
91+
`-g [query]` or `-G [query]` allows you to filter out the output.
92+
* `measure`
93+
* `measure` enables the mode to measure processing time. `measure :off` disables it.
94+
* `$`, `show_source`
95+
* Show the source code of a given method or constant.
96+
* `@`, `whereami`
97+
* Show the source code around binding.irb again.
98+
* `debug`
99+
* Start the debugger of debug.gem.
100+
57101
## Documentation
58102

59103
- [English](https://docs.ruby-lang.org/en/master/index.html)

array.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4555,7 +4555,7 @@ take_items(VALUE obj, long n)
45554555
if (!NIL_P(result)) return rb_ary_subseq(result, 0, n);
45564556
result = rb_ary_new2(n);
45574557
args[0] = result; args[1] = (VALUE)n;
4558-
if (rb_check_block_call(obj, idEach, 0, 0, take_i, (VALUE)args) == Qundef)
4558+
if (UNDEF_P(rb_check_block_call(obj, idEach, 0, 0, take_i, (VALUE)args)))
45594559
rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (must respond to :each)",
45604560
rb_obj_class(obj));
45614561
return result;
@@ -5048,7 +5048,7 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
50485048
ARY_SET_LEN(ary, end);
50495049
}
50505050

5051-
if (item == Qundef) {
5051+
if (UNDEF_P(item)) {
50525052
VALUE v;
50535053
long i;
50545054

@@ -5505,7 +5505,7 @@ rb_ary_cmp(VALUE ary1, VALUE ary2)
55055505
if (NIL_P(ary2)) return Qnil;
55065506
if (ary1 == ary2) return INT2FIX(0);
55075507
v = rb_exec_recursive_paired(recursive_cmp, ary1, ary2, ary2);
5508-
if (v != Qundef) return v;
5508+
if (!UNDEF_P(v)) return v;
55095509
len = RARRAY_LEN(ary1) - RARRAY_LEN(ary2);
55105510
if (len == 0) return INT2FIX(0);
55115511
if (len > 0) return INT2FIX(1);
@@ -6068,7 +6068,7 @@ rb_ary_max(int argc, VALUE *argv, VALUE ary)
60686068
if (rb_block_given_p()) {
60696069
for (i = 0; i < RARRAY_LEN(ary); i++) {
60706070
v = RARRAY_AREF(ary, i);
6071-
if (result == Qundef || rb_cmpint(rb_yield_values(2, v, result), v, result) > 0) {
6071+
if (UNDEF_P(result) || rb_cmpint(rb_yield_values(2, v, result), v, result) > 0) {
60726072
result = v;
60736073
}
60746074
}
@@ -6090,7 +6090,7 @@ rb_ary_max(int argc, VALUE *argv, VALUE ary)
60906090
}
60916091
}
60926092
}
6093-
if (result == Qundef) return Qnil;
6093+
if (UNDEF_P(result)) return Qnil;
60946094
return result;
60956095
}
60966096

@@ -6237,7 +6237,7 @@ rb_ary_min(int argc, VALUE *argv, VALUE ary)
62376237
if (rb_block_given_p()) {
62386238
for (i = 0; i < RARRAY_LEN(ary); i++) {
62396239
v = RARRAY_AREF(ary, i);
6240-
if (result == Qundef || rb_cmpint(rb_yield_values(2, v, result), v, result) < 0) {
6240+
if (UNDEF_P(result) || rb_cmpint(rb_yield_values(2, v, result), v, result) < 0) {
62416241
result = v;
62426242
}
62436243
}
@@ -6259,7 +6259,7 @@ rb_ary_min(int argc, VALUE *argv, VALUE ary)
62596259
}
62606260
}
62616261
}
6262-
if (result == Qundef) return Qnil;
6262+
if (UNDEF_P(result)) return Qnil;
62636263
return result;
62646264
}
62656265

@@ -8148,7 +8148,7 @@ finish_exact_sum(long n, VALUE r, VALUE v, int z)
81488148
{
81498149
if (n != 0)
81508150
v = rb_fix_plus(LONG2FIX(n), v);
8151-
if (r != Qundef) {
8151+
if (!UNDEF_P(r)) {
81528152
v = rb_rational_plus(r, v);
81538153
}
81548154
else if (!n && z) {
@@ -8227,7 +8227,7 @@ rb_ary_sum(int argc, VALUE *argv, VALUE ary)
82278227
else if (RB_BIGNUM_TYPE_P(e))
82288228
v = rb_big_plus(e, v);
82298229
else if (RB_TYPE_P(e, T_RATIONAL)) {
8230-
if (r == Qundef)
8230+
if (UNDEF_P(r))
82318231
r = e;
82328232
else
82338233
r = rb_rational_plus(r, e);

benchmark/lib/benchmark_driver/runner/mjit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def parse(**)
1616
job.prelude = "#{job.prelude}\n#{<<~EOS}"
1717
if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
1818
__bmdv_ruby_i = 0
19-
while __bmdv_ruby_i < 10000 # jit_min_calls
19+
while __bmdv_ruby_i < 10000 # MJIT call threshold
2020
#{job.script}
2121
__bmdv_ruby_i += 1
2222
end

bootstraptest/test_ractor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def test n
285285
30.times.map{|i|
286286
test i
287287
}
288-
} unless ENV['RUN_OPTS'] =~ /--jit-min-calls=5/ || # This always fails with --jit-wait --jit-min-calls=5
288+
} unless ENV['RUN_OPTS'] =~ /--mjit-call-threshold=5/ || # This always fails with --mjit-wait --mjit-call-threshold=5
289289
(ENV.key?('TRAVIS') && ENV['TRAVIS_CPU_ARCH'] == 'arm64') # https://bugs.ruby-lang.org/issues/17878
290290

291291
# Exception for empty select

bootstraptest/test_yjit.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,29 @@ def call_graph_root
4747
Object.send(:remove_const, :Foo)
4848
}
4949

50+
assert_normal_exit %q{
51+
# Test to ensure send on overriden c functions
52+
# doesn't corrupt the stack
53+
class Bar
54+
def bar(x)
55+
x
56+
end
57+
end
58+
59+
class Foo
60+
def bar
61+
Bar.new
62+
end
63+
end
64+
65+
foo = Foo.new
66+
# before this change, this line would error
67+
# because "s" would still be on the stack
68+
# String.to_s is the overridden method here
69+
p foo.bar.bar("s".__send__(:to_s))
70+
}
71+
72+
5073
assert_equal '[nil, nil, nil, nil, nil, nil]', %q{
5174
[NilClass, TrueClass, FalseClass, Integer, Float, Symbol].each do |klass|
5275
klass.class_eval("def foo = @foo")

class.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ push_subclass_entry_to_list(VALUE super, VALUE klass)
6464
void
6565
rb_class_subclass_add(VALUE super, VALUE klass)
6666
{
67-
if (super && super != Qundef) {
67+
if (super && !UNDEF_P(super)) {
6868
rb_subclass_entry_t *entry = push_subclass_entry_to_list(super, klass);
6969
RCLASS_SUBCLASS_ENTRY(klass) = entry;
7070
}
@@ -277,7 +277,7 @@ rb_class_update_superclasses(VALUE klass)
277277
VALUE super = RCLASS_SUPER(klass);
278278

279279
if (!RB_TYPE_P(klass, T_CLASS)) return;
280-
if (super == Qundef) return;
280+
if (UNDEF_P(super)) return;
281281

282282
// If the superclass array is already built
283283
if (RCLASS_SUPERCLASSES(klass))
@@ -608,7 +608,7 @@ rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach)
608608
arg.klass = clone;
609609
rb_id_table_foreach(RCLASS_CONST_TBL(klass), clone_const_i, &arg);
610610
}
611-
if (attach != Qundef) {
611+
if (!UNDEF_P(attach)) {
612612
rb_singleton_class_attached(clone, attach);
613613
}
614614
RCLASS_M_TBL_INIT(clone);

0 commit comments

Comments
 (0)
0