From 180e24cc14d761a7cb8e7e60adbd91fb5f663e6d Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 7 Nov 2009 03:51:39 +0000 Subject: * vm_insnhelper.c (VM_CALLEE_SETUP_ARG): revert r25521. [ruby-core:26427] [ruby-core:26447] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_insnhelper.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'vm_insnhelper.c') diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 7974a75cd..6d4887024 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -100,23 +100,22 @@ vm_pop_frame(rb_thread_t *th) /* method dispatch */ -#define VM_CALLEE_SETUP_ARG(ret, th, iseq, orig_argc, orig_argv, block, e) \ +#define VM_CALLEE_SETUP_ARG(ret, th, iseq, orig_argc, orig_argv, block) \ if (LIKELY(iseq->arg_simple & 0x01)) { \ /* simple check */ \ - e = -1; \ - ret = 0; \ if (orig_argc != iseq->argc) { \ - e = iseq->argc; \ + rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", orig_argc, iseq->argc); \ } \ + ret = 0; \ } \ else { \ - ret = vm_callee_setup_arg_complex(th, iseq, orig_argc, orig_argv, block, &e); \ + ret = vm_callee_setup_arg_complex(th, iseq, orig_argc, orig_argv, block); \ } static inline int vm_callee_setup_arg_complex(rb_thread_t *th, const rb_iseq_t * iseq, int orig_argc, VALUE * orig_argv, - const rb_block_t **block, int *argerr) + const rb_block_t **block) { const int m = iseq->argc; int argc = orig_argc; @@ -127,11 +126,8 @@ vm_callee_setup_arg_complex(rb_thread_t *th, const rb_iseq_t * iseq, /* mandatory */ if (argc < (m + iseq->arg_post_len)) { /* check with post arg */ - *argerr = m + iseq->arg_post_len; - return 0; - } - else { - *argerr = -1; + rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", + argc, m + iseq->arg_post_len); } argv += m; @@ -449,9 +445,8 @@ vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp, int opt_pc, i; VALUE *sp, *rsp = cfp->sp - argc; rb_iseq_t *iseq = me->def->body.iseq; - int eargc = 0; - VM_CALLEE_SETUP_ARG(opt_pc, th, iseq, argc, rsp, &blockptr, eargc); + VM_CALLEE_SETUP_ARG(opt_pc, th, iseq, argc, rsp, &blockptr); /* stack overflow check */ CHECK_STACK_OVERFLOW(cfp, iseq->stack_max); @@ -494,9 +489,6 @@ vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp, VM_FRAME_MAGIC_METHOD, recv, (VALUE) blockptr, iseq->iseq_encoded + opt_pc, sp, 0, 0); } - if (eargc >= 0) { - rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, eargc); - } } static inline VALUE @@ -896,11 +888,8 @@ vm_yield_setup_args(rb_thread_t * const th, const rb_iseq_t *iseq, if (lambda) { /* call as method */ - int opt_pc, e; - VM_CALLEE_SETUP_ARG(opt_pc, th, iseq, argc, argv, &blockptr, e); - if (e >= 0) { - rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, e); - } + int opt_pc; + VM_CALLEE_SETUP_ARG(opt_pc, th, iseq, argc, argv, &blockptr); return opt_pc; } else { -- cgit