mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_insnhelper.c (VM_CALLEE_SETUP_ARG): revert r25521.
[ruby-core:26427] [ruby-core:26447] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e2dcdbd19
commit
ddc4143af0
2 changed files with 15 additions and 21 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Nov 7 12:41:19 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* vm_insnhelper.c (VM_CALLEE_SETUP_ARG): revert r25521.
|
||||
[ruby-core:26427] [ruby-core:26447]
|
||||
|
||||
Fri Nov 6 18:33:47 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* vm_insnhelper.c (vm_push_frame): add CHECK_STACK_OVERFLOW.
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue