summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorRandy Stauner <randy@r4s6.net>2025-12-12 14:35:41 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2025-12-12 18:55:18 -0500
commit8f81d2b5c3d7e41a116b3b81a628b998d8e283be (patch)
tree0f8ead1f22dcd1cffec07a0def0544489d1e7cc7 /test/ruby
parent2f151e76b5dc578026706b31f054d5caf5374b05 (diff)
ZJIT: Don't inline non-parameter locals
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_zjit.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index 50ffb6138c..df7d2cf223 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -340,6 +340,21 @@ class TestZJIT < Test::Unit::TestCase
}
end
+ def test_return_nonparam_local
+ # Use dead code (if false) to create a local without initialization instructions.
+ assert_compiles 'nil', %q{
+ def foo(a)
+ if false
+ x = nil
+ end
+ x
+ end
+ def test = foo(1)
+ test
+ test
+ }, call_threshold: 2
+ end
+
def test_setlocal_on_eval
assert_compiles '1', %q{
@b = binding