mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 11:33:58 +02:00
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:
parent
922aed92b5
commit
ce02aefabb
2 changed files with 15 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue