summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-21 06:48:00 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-21 06:48:00 +0000
commit969156ce9a04b92ffc5b048cfbe666ae1f7b1cbd (patch)
tree368daa5833f27fde284f165cfcef732f2cdce222 /tool
parent52bd8f6f68a45cb990a827e4a1c276251cdf471c (diff)
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
Diffstat (limited to 'tool')
-rw-r--r--tool/ruby_vm/views/_mjit_compile_send.erb10
1 files changed, 5 insertions, 5 deletions
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