aboutsummaryrefslogtreecommitdiffstats
path: root/bootstraptest
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2021-07-15 11:09:08 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:37 -0400
commit05b5a7f01139a3c9610b80194e4385928dd4cd55 (patch)
tree78c9436e69de0b12b2073ba1b4a5c103dd920b28 /bootstraptest
parent0fdcdd267f7c3a482467f60e00049b88da1ae88c (diff)
downloadruby-05b5a7f01139a3c9610b80194e4385928dd4cd55.tar.gz
Add a guard that we start executing on the first PC
Methods with optional parameters don't always start executing at the first PC, but we compile all methods assuming that they do. This commit adds a guard to ensure that we're actually starting at the first PC for methods with optional params
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_yjit.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index 725eca5eb5..0ca293f59a 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -1,3 +1,14 @@
+# Make sure that optional param methods return the correct value
+assert_equal '1', %q{
+ def m(ary = [])
+ yield(ary)
+ end
+
+ # Warm the JIT with a 0 param call
+ 2.times { m { } }
+ m(1) { |v| v }
+}
+
# Test for topn
assert_equal 'array', %q{
def threequals(a)