aboutsummaryrefslogtreecommitdiffstats
path: root/bootstraptest
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2023-11-22 14:06:37 -0500
committerGitHub <noreply@github.com>2023-11-22 19:06:37 +0000
commit7a93bee4f845f496742b03a0e575ed13631971b7 (patch)
tree07698d0e3f9c811e8cd59effde06b33aca7092dc /bootstraptest
parent3720d4c39af7e88f4be98f5d8e1d8a3d47db5208 (diff)
downloadruby-7a93bee4f845f496742b03a0e575ed13631971b7.tar.gz
YJIT: add an extra btest for shape too complex (#9013)
Following Jean Boussier's comment that some shape bugs were not caught by our tests, I'm trying to improve our test coverage a tiny bit.
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_yjit.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index a2a05c45d7..a7ef90ba74 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -278,6 +278,33 @@ assert_equal '["instance-variable", 5]', %q{
Foo.new.foo
}
+# getinstancevariable with shape too complex
+assert_normal_exit %q{
+ class Foo
+ def initialize
+ @a = 1
+ end
+
+ def getter
+ @foobar
+ end
+ end
+
+ # Initialize ivars in changing order, making the Foo
+ # class have shape too complex
+ 100.times do |x|
+ foo = Foo.new
+ foo.instance_variable_set(:"@a#{x}", 1)
+ foo.instance_variable_set(:"@foobar", 777)
+
+ # The getter method eventually sees shape too complex
+ r = foo.getter
+ if r != 777
+ raise "error"
+ end
+ end
+}
+
assert_equal '0', %q{
# This is a regression test for incomplete invalidation from
# opt_setinlinecache. This test might be brittle, so