From 969156ce9a04b92ffc5b048cfbe666ae1f7b1cbd Mon Sep 17 00:00:00 2001 From: k0kubun Date: Thu, 21 Mar 2019 06:48:00 +0000 Subject: Check argument_arity_error condition in inlinable_iseq_p to avoid inlining a method call when it becomes argument_arity_error, fixing a potential bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/ruby_vm/views/_mjit_compile_send.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tool/ruby_vm') diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb index fa022af791..0c59e040ce 100644 --- a/tool/ruby_vm/views/_mjit_compile_send.erb +++ b/tool/ruby_vm/views/_mjit_compile_send.erb @@ -18,14 +18,14 @@ % if (has_valid_method_type(cc_copy)) { const rb_iseq_t *iseq; - unsigned int argc = ci->orig_argc; /* unlike `ci->orig_argc`, `argc` may include blockarg */ + unsigned int argc = ci->orig_argc; // this `argc` variable is for calculating a value's position on stack considering `blockarg`. % if insn.name == 'send' - argc += ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0); + argc += ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0); // simulate `vm_caller_setup_arg_block`'s `--reg_cfp->sp` % end - if (!(ci->flag & VM_CALL_TAILCALL) && /* inlining non-tailcall path */ - cc_copy->me->def->type == VM_METHOD_TYPE_ISEQ && inlinable_iseq_p(ci, cc_copy, iseq = def_iseq_ptr(cc_copy->me->def)) /* CC_SET_FASTPATH in vm_callee_setup_arg */) { - int param_size = iseq->body->param.size; /* TODO: check calling->argc for argument_arity_error */ + if (!(ci->flag & VM_CALL_TAILCALL) // inlining non-tailcall path + && cc_copy->me->def->type == VM_METHOD_TYPE_ISEQ && inlinable_iseq_p(ci, cc_copy, iseq = def_iseq_ptr(cc_copy->me->def))) { // CC_SET_FASTPATH in vm_callee_setup_arg + int param_size = iseq->body->param.size; fprintf(f, "{\n"); % # JIT: Declare stack_size to be used in some macro of _mjit_compile_insn_body.erb -- cgit v1.2.3