Skip to content

Commit 0602345

Browse files
committed
Merge remote-tracking branch 'upstream/master' into Ractor-Local-GC-version-3
2 parents d34c2c3 + 28491e5 commit 0602345

Some content is hidden

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

87 files changed

+1601
-1079
lines changed

.gdbinit

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,14 @@ document rp_bignum
523523
end
524524

525525
define rp_class
526+
set $class_and_classext = (struct RClass_and_rb_classext_t *)($arg0)
526527
printf "(struct RClass *) %p", (void*)$arg0
527-
if RCLASS_ORIGIN((struct RClass *)($arg0)) != $arg0
528-
printf " -> %p", RCLASS_ORIGIN((struct RClass *)($arg0))
528+
if $class_and_classext->classext->origin_ != (VALUE)$arg0
529+
printf " -> %p", $class_and_classext->classext->origin_
529530
end
530531
printf "\n"
531532
rb_classname $arg0
532-
print/x *(struct RClass *)($arg0)
533-
print *RCLASS_EXT((struct RClass *)($arg0))
533+
print/x *$class_and_classext
534534
end
535535
document rp_class
536536
Print the content of a Class/Module.
@@ -896,10 +896,10 @@ document rb_method_entry
896896
end
897897

898898
define rb_classname
899-
# up to 128bit int
900-
set $rb_classname = rb_mod_name($arg0)
901-
if $rb_classname != RUBY_Qnil
902-
rp $rb_classname
899+
set $rb_classname = ((struct RClass_and_rb_classext_t*)$arg0)->classext->classpath
900+
if $rb_classname != RUBY_Qfalse
901+
print_string $rb_classname
902+
printf "\n"
903903
else
904904
echo anonymous class/module\n
905905
end

.github/workflows/windows.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,24 @@ jobs:
2525
strategy:
2626
matrix:
2727
include:
28-
- vc: 2015
29-
vs: 2019
28+
- os: 2019
29+
vc: 2015
3030
vcvars: '10.0.14393.0 -vcvars_ver=14.0' # The oldest Windows 10 SDK w/ VC++ 2015 toolset (v140)
3131
test_task: check
32-
- vs: 2019
32+
- os: 2019
33+
vc: 2019
3334
test_task: check
34-
- vs: 2019
35+
- os: 2022
36+
vc: 2019
37+
vcvars: '10.0.22621.0 -vcvars_ver=14.2' # The defautl Windows 11 SDK and toolset are broken at windows-2022
38+
test_task: check
39+
- os: 2022
40+
vc: 2019
41+
vcvars: '10.0.22621.0 -vcvars_ver=14.2'
3542
test_task: test-bundled-gems
36-
# - vs: 2022
37-
# test_task: check
3843
fail-fast: false
3944

40-
runs-on: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
45+
runs-on: windows-${{ matrix.os < 2022 && '2019' || matrix.os }}
4146

4247
if: >-
4348
${{!(false
@@ -49,11 +54,11 @@ jobs:
4954
|| (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
5055
)}}
5156
52-
name: VisualStudio ${{ matrix.vc || matrix.vs }} (${{ matrix.test_task }})
57+
name: Windows ${{ matrix.os }}/Visual C++ ${{ matrix.vc }} (${{ matrix.test_task }})
5358

5459
env:
5560
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
56-
OS_VER: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
61+
OS_VER: windows-${{ matrix.os < 2022 && '2019' || matrix.os }}
5762
VCPKG_DEFAULT_TRIPLET: ${{ matrix.target || 'x64' }}-windows
5863

5964
steps:
@@ -123,7 +128,7 @@ jobs:
123128
# %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
124129
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
125130
run: |
126-
::- Set up VC ${{ matrix.vc || matrix.vs }}
131+
::- Set up VC ${{ matrix.vc }}
127132
set vswhere="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
128133
for /f "delims=;" %%I in ('%vswhere% -latest -property installationPath') do (
129134
set VCVARS="%%I\VC\Auxiliary\Build\vcvars64.bat"
@@ -179,7 +184,7 @@ jobs:
179184
- name: Set up Launchable
180185
uses: ./.github/actions/launchable/setup
181186
with:
182-
os: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
187+
os: windows-${{ matrix.os < 2022 && '2019' || matrix.os }}
183188
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
184189
builddir: build
185190
srcdir: src
@@ -194,7 +199,7 @@ jobs:
194199

195200
- uses: ./.github/actions/slack
196201
with:
197-
label: VS${{ matrix.vc || matrix.vs }} / ${{ matrix.test_task || 'check' }}
202+
label: Windows ${{ matrix.os }} / VC ${{ matrix.vc }} / ${{ matrix.test_task || 'check' }}
198203
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
199204
if: ${{ failure() }}
200205

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
See ["Contributing to Ruby"](https://docs.ruby-lang.org/en/master/contributing_md.html), which includes setup and build instructions.
1+
See ["Contributing to Ruby"](https://docs.ruby-lang.org/en/master/contributing/contributing_md.html), which includes setup and build instructions.

NEWS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ Note: We're only listing outstanding class updates.
2020
Also, `Binding#local_variable_get` and `Binding#local_variable_set` reject to handle numbered parameters.
2121
[[Bug #21049]]
2222

23+
* IO
24+
25+
* `IO.select` accepts +Float::INFINITY+ as a timeout argument.
26+
[[Feature #20610]]
27+
2328
* String
2429

2530
* Update Unicode to Version 15.1.0 and Emoji Version 15.1. [[Feature #19908]]
@@ -34,7 +39,7 @@ The following bundled gems are promoted from default gems.
3439
* benchmark 0.4.0
3540
* logger 1.7.0
3641
* rdoc 6.13.1
37-
* win32ole 1.9.1
42+
* win32ole 1.9.2
3843
* irb 1.15.2
3944
* reline 0.6.1
4045
* readline 0.0.4
@@ -58,6 +63,7 @@ The following default gems are updated.
5863
* prism 1.4.0
5964
* psych 5.2.3
6065
* stringio 3.1.6
66+
* strscan 3.1.3
6167
* uri 1.0.3
6268

6369
The following bundled gems are added.
@@ -73,7 +79,7 @@ The following bundled gems are updated.
7379
* rbs 3.9.2
7480
* bigdecimal 3.1.9
7581
* syslog 0.3.0
76-
* csv 3.3.3
82+
* csv 3.3.4
7783
* repl_type_completor 0.1.11
7884

7985
## Supported platforms

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Bugs should be reported at https://bugs.ruby-lang.org. Read ["Reporting Issues"]
8585

8686
## Contributing
8787

88-
See ["Contributing to Ruby"](https://docs.ruby-lang.org/en/master/contributing_md.html), which includes setup and build instructions.
88+
See ["Contributing to Ruby"](https://docs.ruby-lang.org/en/master/contributing/contributing_md.html), which includes setup and build instructions.
8989

9090
## The Author
9191

array.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "ractor_core.h"
2929
#include "ruby/encoding.h"
3030
#include "ruby/st.h"
31+
#include "ruby/thread.h"
3132
#include "ruby/util.h"
3233
#include "vm_core.h"
3334
#include "builtin.h"
@@ -529,6 +530,8 @@ rb_ary_set_shared(VALUE ary, VALUE shared_root)
529530
static inline void
530531
rb_ary_modify_check(VALUE ary)
531532
{
533+
RUBY_ASSERT(ruby_thread_has_gvl_p());
534+
532535
rb_check_frozen(ary);
533536
ary_verify(ary);
534537
}
@@ -713,6 +716,8 @@ empty_ary_alloc(VALUE klass)
713716
static VALUE
714717
ary_new(VALUE klass, long capa)
715718
{
719+
RUBY_ASSERT(ruby_thread_has_gvl_p());
720+
716721
VALUE ary;
717722

718723
if (capa < 0) {

benchmark/object_id.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
benchmark:
2+
baseline: "Object.new"
3+
object_id: "Object.new.object_id"
4+
# loop_count: 100000

bootstraptest/test_ractor.rb

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,3 +2122,76 @@ def ==(o)
21222122
roundtripped_obj = ractor.take
21232123
roundtripped_obj.instance_variable_get(:@array) == [1] ? :ok : roundtripped_obj
21242124
}
2125+
2126+
# moved composite types move their non-shareable parts properly
2127+
assert_equal 'ok', %q{
2128+
k, v = String.new("key"), String.new("value")
2129+
h = { k => v }
2130+
h.instance_variable_set("@b", String.new("b"))
2131+
a = [k,v]
2132+
o_singleton = Object.new
2133+
def o_singleton.a
2134+
@a
2135+
end
2136+
o_singleton.instance_variable_set("@a", String.new("a"))
2137+
class MyObject
2138+
attr_reader :a
2139+
def initialize(a)
2140+
@a = a
2141+
end
2142+
end
2143+
struct_class = Struct.new(:a)
2144+
struct = struct_class.new(String.new('a'))
2145+
o = MyObject.new(String.new('a'))
2146+
r = Ractor.new do
2147+
loop do
2148+
obj = Ractor.receive
2149+
val = case obj
2150+
when Hash
2151+
obj['key'] == 'value' && obj.instance_variable_get("@b") == 'b'
2152+
when Array
2153+
obj[0] == 'key'
2154+
when Struct
2155+
obj.a == 'a'
2156+
when Object
2157+
obj.a == 'a'
2158+
end
2159+
Ractor.yield val
2160+
end
2161+
end
2162+
2163+
objs = [h, a, o_singleton, o, struct]
2164+
objs.each_with_index do |obj, i|
2165+
klass = obj.class
2166+
parts_moved = {}
2167+
case obj
2168+
when Hash
2169+
parts_moved[klass] = [obj['key'], obj.instance_variable_get("@b")]
2170+
when Array
2171+
parts_moved[klass] = obj.dup # the contents
2172+
when Struct, Object
2173+
parts_moved[klass] = [obj.a]
2174+
end
2175+
r.send(obj, move: true)
2176+
val = r.take
2177+
if val != true
2178+
raise "bad val in ractor for obj at i:#{i}"
2179+
end
2180+
begin
2181+
p obj
2182+
rescue
2183+
else
2184+
raise "should be moved"
2185+
end
2186+
parts_moved.each do |klass, parts|
2187+
parts.each_with_index do |part, j|
2188+
case part
2189+
when Ractor::MovedObject
2190+
else
2191+
raise "part for class #{klass} at i:#{j} should be moved"
2192+
end
2193+
end
2194+
end
2195+
end
2196+
'ok'
2197+
}

class.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,9 +1076,8 @@ rb_define_class(const char *name, VALUE super)
10761076
}
10771077
klass = rb_define_class_id(id, super);
10781078
rb_vm_register_global_object(klass);
1079-
rb_const_set_raw(rb_cObject, id, klass);
1079+
rb_const_set(rb_cObject, id, klass);
10801080
rb_class_inherited(super, klass);
1081-
rb_const_added(klass, id);
10821081

10831082
return klass;
10841083
}
@@ -1116,10 +1115,8 @@ rb_define_class_id_under_no_pin(VALUE outer, ID id, VALUE super)
11161115
}
11171116
klass = rb_define_class_id(id, super);
11181117
rb_set_class_path_string(klass, outer, rb_id2str(id));
1119-
1120-
rb_const_set_raw(outer, id, klass);
1118+
rb_const_set(outer, id, klass);
11211119
rb_class_inherited(super, klass);
1122-
rb_const_added(outer, id);
11231120

11241121
return klass;
11251122
}

common.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,6 +2277,7 @@ array.$(OBJEXT): {$(VPATH)}rubyparser.h
22772277
array.$(OBJEXT): {$(VPATH)}shape.h
22782278
array.$(OBJEXT): {$(VPATH)}st.h
22792279
array.$(OBJEXT): {$(VPATH)}subst.h
2280+
array.$(OBJEXT): {$(VPATH)}thread.h
22802281
array.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
22812282
array.$(OBJEXT): {$(VPATH)}thread_native.h
22822283
array.$(OBJEXT): {$(VPATH)}util.h
@@ -17548,6 +17549,7 @@ string.$(OBJEXT): {$(VPATH)}shape.h
1754817549
string.$(OBJEXT): {$(VPATH)}st.h
1754917550
string.$(OBJEXT): {$(VPATH)}string.c
1755017551
string.$(OBJEXT): {$(VPATH)}subst.h
17552+
string.$(OBJEXT): {$(VPATH)}thread.h
1755117553
string.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
1755217554
string.$(OBJEXT): {$(VPATH)}thread_native.h
1755317555
string.$(OBJEXT): {$(VPATH)}util.h

0 commit comments

Comments
 (0)