Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions test/ruby/test_yjit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,20 @@ def to_s
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)
Expand Down
2 changes: 1 addition & 1 deletion yjit_codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2863,7 +2863,7 @@ gen_send_cfunc(jitstate_t *jit, ctx_t *ctx, const struct rb_callinfo *ci, const
}

// Don't JIT functions that need C stack arguments for now
if (argc + 1 > NUM_C_ARG_REGS) {
if (cfunc->argc >= 0 && argc + 1 > NUM_C_ARG_REGS) {
GEN_COUNTER_INC(cb, send_cfunc_toomany_args);
return YJIT_CANT_COMPILE;
}
Expand Down