summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-01 17:03:53 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-01 17:03:53 +0000
commit5d2ea90418937eb7ad56bf1950e1864c68c6e5cd (patch)
treeef7cd7d00f801618947aa6c653cd1bbe51e8134d /vm_insnhelper.c
parent5a22835c22c3d95968b418c31cd23a28f978890f (diff)
merge revision(s) r45320,r45321: [Backport #9622]
* vm_insnhelper.c (vm_callee_setup_arg): turn a macro into an inline function. * vm_insnhelper.c (vm_callee_setup_arg): disable fastpath if splat argument, since argc may differ for each calls. [ruby-core:61422] [Bug #9622] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 8c7071a91e..9e1dbe16a9 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1196,23 +1196,33 @@ static VALUE vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_c
static inline VALUE vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci);
static inline VALUE vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci);
-#define VM_CALLEE_SETUP_ARG(th, ci, iseq, argv, is_lambda) \
- if (LIKELY((iseq)->arg_simple & 0x01)) { \
- /* simple check */ \
- if ((ci)->argc != (iseq)->argc) { \
- argument_error((iseq), ((ci)->argc), (iseq)->argc, (iseq)->argc); \
- } \
- (ci)->aux.opt_pc = 0; \
- CI_SET_FASTPATH((ci), UNLIKELY((ci)->flag & VM_CALL_TAILCALL) ? vm_call_iseq_setup_tailcall : vm_call_iseq_setup_normal, !(is_lambda) && !((ci)->me->flag & NOEX_PROTECTED)); \
- } \
- else { \
- (ci)->aux.opt_pc = vm_callee_setup_arg_complex((th), (ci), (iseq), (argv)); \
+static inline void
+vm_callee_setup_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq,
+ VALUE *argv, int is_lambda)
+{
+ if (LIKELY(iseq->arg_simple & 0x01)) {
+ /* simple check */
+ if (ci->argc != iseq->argc) {
+ argument_error(iseq, ci->argc, iseq->argc, iseq->argc);
+ }
+ ci->aux.opt_pc = 0;
+ CI_SET_FASTPATH(ci,
+ (UNLIKELY(ci->flag & VM_CALL_TAILCALL) ?
+ vm_call_iseq_setup_tailcall :
+ vm_call_iseq_setup_normal),
+ (!is_lambda &&
+ !(ci->flag & VM_CALL_ARGS_SPLAT) && /* argc may differ for each calls */
+ !(ci->me->flag & NOEX_PROTECTED)));
+ }
+ else {
+ ci->aux.opt_pc = vm_callee_setup_arg_complex(th, ci, iseq, argv);
}
+}
static VALUE
vm_call_iseq_setup(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
{
- VM_CALLEE_SETUP_ARG(th, ci, ci->me->def->body.iseq, cfp->sp - ci->argc, 0);
+ vm_callee_setup_arg(th, ci, ci->me->def->body.iseq, cfp->sp - ci->argc, 0);
return vm_call_iseq_setup_2(th, cfp, ci);
}
@@ -2300,7 +2310,7 @@ vm_yield_setup_args(rb_thread_t * const th, const rb_iseq_t *iseq,
ci_entry.flag = 0;
ci_entry.argc = argc;
ci_entry.blockptr = (rb_block_t *)blockptr;
- VM_CALLEE_SETUP_ARG(th, &ci_entry, iseq, argv, 1);
+ vm_callee_setup_arg(th, &ci_entry, iseq, argv, 1);
return ci_entry.aux.opt_pc;
}
else {