aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ruby_vm/rjit
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-03-25 22:13:35 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2023-03-25 22:14:07 -0700
commitddb77dd11e5030b9d7dbf1f3e93e5e4cad1268b3 (patch)
treebfe5414e334200d8b1cb3e7e59112474035196d8 /lib/ruby_vm/rjit
parenta624a5d709e6ee76cbda63b09fe1f99ae6c0e9be (diff)
downloadruby-ddb77dd11e5030b9d7dbf1f3e93e5e4cad1268b3.tar.gz
RJIT: Put a guard for splat w/ var-arg cfunc
Diffstat (limited to 'lib/ruby_vm/rjit')
-rw-r--r--lib/ruby_vm/rjit/insn_compiler.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/ruby_vm/rjit/insn_compiler.rb b/lib/ruby_vm/rjit/insn_compiler.rb
index 163395ecf4..2dfe52713b 100644
--- a/lib/ruby_vm/rjit/insn_compiler.rb
+++ b/lib/ruby_vm/rjit/insn_compiler.rb
@@ -4152,7 +4152,7 @@ module RubyVM::RJIT
def jit_call_cfunc_with_frame(jit, ctx, asm, cme, flags, argc, block_handler, known_recv_class, send_shift:)
cfunc = cme.def.body.cfunc
- if argc + 1 > 6
+ if argc + 1 > C_ARGS.size
asm.incr_counter(:send_cfunc_too_many_args)
return CantCompile
end
@@ -4191,6 +4191,12 @@ module RubyVM::RJIT
# Push splat args, which was skipped in jit_caller_setup_arg.
if flags & C::VM_CALL_ARGS_SPLAT != 0
+ # We aren't handling a vararg cfuncs with splat currently.
+ if cfunc.argc == -1
+ asm.incr_counter(:send_args_splat_cfunc_var_args)
+ return CantCompile
+ end
+
required_args = cfunc.argc - (argc - 1)
# + 1 for self
if required_args + 1 >= C_ARGS.size