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.
This commit is contained in:
John Hawthorn 2021-09-04 01:35:22 -07:00 committed by Alan Wu
parent 922aed92b5
commit ce02aefabb
2 changed files with 15 additions and 1 deletions

View file

@ -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)