summaryrefslogtreecommitdiff
path: root/test/ruby/test_zjit.rb
diff options
context:
space:
mode:
authorywenc <ywenc@github.com>2025-06-30 15:26:23 -0400
committerTakashi Kokubun <takashikkbn@gmail.com>2025-06-30 17:04:15 -0700
commit03e08a946d498e75e1bb31ddb28fc012dc4694f5 (patch)
tree7ced9e9cb038754b9d441e31513b484c8fbbc907 /test/ruby/test_zjit.rb
parent4a7d1a7062e7802eb6758bab121eecde59b19125 (diff)
ZJIT: Add codegen for IsNil
Diffstat (limited to 'test/ruby/test_zjit.rb')
-rw-r--r--test/ruby/test_zjit.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index 823fb8e043..e7ce1e1837 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -831,6 +831,15 @@ class TestZJIT < Test::Unit::TestCase
}, call_threshold: 2
end
+ def test_branchnil
+ assert_compiles '[2, nil]', %q{
+ def test(x)
+ x&.succ
+ end
+ [test(1), test(nil)]
+ }, call_threshold: 1, insns: [:branchnil]
+ 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