diff options
author | John Hawthorn <john@hawthorn.email> | 2021-09-04 01:35:22 -0700 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:39 -0400 |
commit | ce02aefabbc4536e3b7f8b13e4c9dc1ac3d258b4 (patch) | |
tree | 26e51bdd19910af2f84bd625aa209c7678b08a31 /test/ruby/test_yjit.rb | |
parent | 922aed92b5e4602571d191e62904304458c9998d (diff) | |
download | ruby-ce02aefabbc4536e3b7f8b13e4c9dc1ac3d258b4.tar.gz |
Allow calling variadic cfuncs with many args
We have a check to ensure we don't have to push args on the stack to
call a cfunc with many args. However we never need to use the stack for
variadic cfuncs, so we shouldn't care about the number of arguments.
Diffstat (limited to 'test/ruby/test_yjit.rb')
-rw-r--r-- | test/ruby/test_yjit.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index ccd0e6bae0..587e6d3f1d 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -217,6 +217,20 @@ class TestYJIT < Test::Unit::TestCase RUBY end + # Tests calling a variadic cfunc with many args + def test_build_large_struct + assert_compiles(<<~RUBY, insns: %i[opt_send_without_block], min_calls: 2) + ::Foo = Struct.new(:a, :b, :c, :d, :e, :f, :g, :h) + + def build_foo + ::Foo.new(:a, :b, :c, :d, :e, :f, :g, :h) + end + + build_foo + build_foo + RUBY + end + def test_fib_recursion assert_compiles(<<~'RUBY', insns: %i[opt_le opt_minus opt_plus opt_send_without_block], result: 34) def fib(n) |