diff options
author | Peter Zhu <[email protected]> | 2023-11-17 14:05:37 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2023-11-17 13:08:43 -0800 |
commit | 3dd77bc056de19a1cc0ad3fafdb8e49c429dec5a () | |
tree | bc18b727a2a043d17dc66ffeec1352232bd37745 /test | |
parent | 7c99e43c3f050244b06dbd18de4f605ea70d234c (diff) |
Fix corruption when out of shape during ivar remove
Reproduction script: ``` o = Object.new 10.times { |i| o.instance_variable_set(:"@a#{i}", i) } i = 0 a = Object.new while RubyVM::Shape.shapes_available > 2 a.instance_variable_set(:"@i#{i}", 1) i += 1 end o.remove_instance_variable(:@a0) puts o.instance_variable_get(:@a1) ``` Before this , it would incorrectly output `2` and now it correctly outputs `1`.
-rw-r--r-- | test/ruby/test_shapes.rb | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -414,6 +414,27 @@ class TestShapes < Test::Unit::TestCase assert_equal true, A.instance_variable_defined?(:@a) end; end def test_run_out_of_shape_remove_instance_variable assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; |