aboutsummaryrefslogtreecommitdiffstats
path: root/mjit_compile.c
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 /mjit_compile.c
parent52bd8f6f68a45cb990a827e4a1c276251cdf471c (diff)
downloadruby-969156ce9a04b92ffc5b048cfbe666ae1f7b1cbd.tar.gz
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 'mjit_compile.c')
-rw-r--r--mjit_compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mjit_compile.c b/mjit_compile.c
index 1407c4635a..b57a988926 100644
--- a/mjit_compile.c
+++ b/mjit_compile.c
@@ -65,11 +65,12 @@ has_valid_method_type(CALL_CACHE cc)
// Returns true if iseq is inlinable, otherwise NULL. This becomes true in the same condition
// as CC_SET_FASTPATH (in vm_callee_setup_arg) is called from vm_call_iseq_setup.
static bool
-inlinable_iseq_p(CALL_INFO ci, CALL_CACHE cc, const rb_iseq_t *iseq)
+inlinable_iseq_p(const CALL_INFO ci, const CALL_CACHE cc, const rb_iseq_t *iseq)
{
extern bool rb_simple_iseq_p(const rb_iseq_t *iseq);
return iseq != NULL
&& !(ci->flag & VM_CALL_KW_SPLAT) && rb_simple_iseq_p(iseq) // Top of vm_callee_setup_arg. In this case, opt_pc is 0.
+ && ci->orig_argc == iseq->body->param.lead_num // exclude argument_arity_error (assumption: `calling->argc == ci->orig_argc` in send insns)
&& vm_call_iseq_optimizable_p(ci, cc); // CC_SET_FASTPATH condition
}