mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
Fix wrong GENIV WB on too_complex Ractor traversal
WBCHECK ERROR: Missed write barrier detected!
Parent object: 0x7c4a5f1f66c0 (wb_protected: true)
rb_obj_info_dump: 0x00007c4a5f1f66c0 T_IMEMO/<fields>
Reference counts - snapshot: 2, writebarrier: 0, current: 2, missed: 1
Missing reference to: 0x7b6a5f2f7010
rb_obj_info_dump: 0x00007b6a5f2f7010 T_ARRAY/Array [E ] len: 1 (embed)
This commit is contained in:
parent
12b0ce3875
commit
365317f6ba
@ -1923,6 +1923,60 @@ assert_equal 'ok', %q{
|
||||
roundtripped_obj.instance_variable_get(:@array) == [1] ? :ok : roundtripped_obj
|
||||
}
|
||||
|
||||
# move object with many generic ivars
|
||||
assert_equal 'ok', %q{
|
||||
ractor = Ractor.new { Ractor.receive }
|
||||
obj = Array.new(10, 42)
|
||||
0.upto(300) do |i|
|
||||
obj.instance_variable_set(:"@array#{i}", [i])
|
||||
end
|
||||
|
||||
ractor.send(obj, move: true)
|
||||
roundtripped_obj = ractor.value
|
||||
roundtripped_obj.instance_variable_get(:@array1) == [1] ? :ok : roundtripped_obj
|
||||
}
|
||||
|
||||
# move object with complex generic ivars
|
||||
assert_equal 'ok', %q{
|
||||
# Make Array too_complex
|
||||
30.times { |i| [].instance_variable_set(:"@complex#{i}", 1) }
|
||||
|
||||
ractor = Ractor.new { Ractor.receive }
|
||||
obj = Array.new(10, 42)
|
||||
obj.instance_variable_set(:@array1, [1])
|
||||
|
||||
ractor.send(obj, move: true)
|
||||
roundtripped_obj = ractor.value
|
||||
roundtripped_obj.instance_variable_get(:@array1) == [1] ? :ok : roundtripped_obj
|
||||
}
|
||||
|
||||
# copy object with complex generic ivars
|
||||
assert_equal 'ok', %q{
|
||||
# Make Array too_complex
|
||||
30.times { |i| [].instance_variable_set(:"@complex#{i}", 1) }
|
||||
|
||||
ractor = Ractor.new { Ractor.receive }
|
||||
obj = Array.new(10, 42)
|
||||
obj.instance_variable_set(:@array1, [1])
|
||||
|
||||
ractor.send(obj)
|
||||
roundtripped_obj = ractor.value
|
||||
roundtripped_obj.instance_variable_get(:@array1) == [1] ? :ok : roundtripped_obj
|
||||
}
|
||||
|
||||
# copy object with many generic ivars
|
||||
assert_equal 'ok', %q{
|
||||
ractor = Ractor.new { Ractor.receive }
|
||||
obj = Array.new(10, 42)
|
||||
0.upto(300) do |i|
|
||||
obj.instance_variable_set(:"@array#{i}", [i])
|
||||
end
|
||||
|
||||
ractor.send(obj)
|
||||
roundtripped_obj = ractor.value
|
||||
roundtripped_obj.instance_variable_get(:@array1) == [1] ? :ok : roundtripped_obj
|
||||
}
|
||||
|
||||
# moved composite types move their non-shareable parts properly
|
||||
assert_equal 'ok', %q{
|
||||
k, v = String.new("key"), String.new("value")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user