Do not use VM stack for splat arg on cfunc

On the cfunc methods, if a splat argument is given, all array elements
are expanded on the VM stack and it can cause SystemStackError.
The idea to avoid it is making a hidden array to contain all parameters
and use this array as an argv.

This patch is reviesed version of https://github.com/ruby/ruby/pull/6816
The main change is all changes are closed around calling cfunc logic.

Fixes [Bug #4040]

Co-authored-by: Jeremy Evans <code@jeremyevans.net>
This commit is contained in:
Koichi Sasada 2023-01-12 23:56:29 +09:00
parent 537183cd2a
commit 2e7bceb34e
Notes: git 2023-01-13 00:30:53 +00:00
3 changed files with 200 additions and 12 deletions

View file

@ -297,7 +297,7 @@ struct rb_calling_info {
VALUE block_handler;
VALUE recv;
int argc;
int kw_splat;
bool kw_splat;
};
struct rb_execution_context_struct;