summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMax Bernstein <[email protected]>2025-06-05 11:43:56 -0400
committerAlan Wu <[email protected]>2025-06-06 16:17:54 +0900
commit6a46ca31a7d4999e9788896445fbb53d049882ab (patch)
treee365720c4d327358674a8fe37f79303aeeaca0ce /test
parent2eb0a1a7498db7605a381a6c774b043a74779f16 (diff)
ZJIT: Add codegen for uncached getinstancevariable
I didn't know `rb_ivar_get` existed until @Xrxr pointed me to it. Thanks, Alan!
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13527
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_zjit.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index d6fc4ba2f7..d4f53dcb5b 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -545,6 +545,20 @@ class TestZJIT < Test::Unit::TestCase
}
end
+ def test_getinstancevariable
+ assert_compiles 'nil', %q{
+ def test() = @foo
+
+ test()
+ }
+ assert_compiles '3', %q{
+ @foo = 3
+ def test() = @foo
+
+ test()
+ }
+ end
+
# tool/ruby_vm/views/*.erb relies on the zjit instructions a) being contiguous and
# b) being reliably ordered after all the other instructions.
def test_instruction_order