* vm_insnhelper.c (vm_setup_method): should push call frame before
raising exception, to put the Ruby-defined method name in the error message. [ruby-core:26333] * vm_insnhelper.c (VM_CALLEE_SETUP_ARG): macro modified. * vm_insnhelper.c (vm_yield_setup_args): modified for new VM_CALLEE_SETUP_ARG macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
db115a545f
commit
2e868a3442
11
ChangeLog
11
ChangeLog
@ -12,6 +12,17 @@ Wed Oct 28 13:02:10 2009 Shugo Maeda <shugo@ruby-lang.org>
|
|||||||
* lib/net/ftp.rb (Net::FTP#login): calls send_type_command instead
|
* lib/net/ftp.rb (Net::FTP#login): calls send_type_command instead
|
||||||
of binary=.
|
of binary=.
|
||||||
|
|
||||||
|
Wed Oct 28 12:26:51 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* vm_insnhelper.c (vm_setup_method): should push call frame before
|
||||||
|
raising exception, to put the Ruby-defined method name in the
|
||||||
|
error message. [ruby-core:26333]
|
||||||
|
|
||||||
|
* vm_insnhelper.c (VM_CALLEE_SETUP_ARG): macro modified.
|
||||||
|
|
||||||
|
* vm_insnhelper.c (vm_yield_setup_args): modified for new
|
||||||
|
VM_CALLEE_SETUP_ARG macro.
|
||||||
|
|
||||||
Tue Oct 27 22:46:44 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
Tue Oct 27 22:46:44 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* lib/net/ftp.rb (Net::FTP#initialize): @sock = nil.
|
* lib/net/ftp.rb (Net::FTP#initialize): @sock = nil.
|
||||||
|
@ -98,22 +98,23 @@ vm_pop_frame(rb_thread_t *th)
|
|||||||
|
|
||||||
/* method dispatch */
|
/* method dispatch */
|
||||||
|
|
||||||
#define VM_CALLEE_SETUP_ARG(ret, th, iseq, orig_argc, orig_argv, block) \
|
#define VM_CALLEE_SETUP_ARG(ret, th, iseq, orig_argc, orig_argv, block, e) \
|
||||||
if (LIKELY(iseq->arg_simple & 0x01)) { \
|
if (LIKELY(iseq->arg_simple & 0x01)) { \
|
||||||
/* simple check */ \
|
/* simple check */ \
|
||||||
if (orig_argc != iseq->argc) { \
|
e = -1; \
|
||||||
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", orig_argc, iseq->argc); \
|
|
||||||
} \
|
|
||||||
ret = 0; \
|
ret = 0; \
|
||||||
|
if (orig_argc != iseq->argc) { \
|
||||||
|
e = iseq->argc; \
|
||||||
|
} \
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
ret = vm_callee_setup_arg_complex(th, iseq, orig_argc, orig_argv, block); \
|
ret = vm_callee_setup_arg_complex(th, iseq, orig_argc, orig_argv, block, &e); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
vm_callee_setup_arg_complex(rb_thread_t *th, const rb_iseq_t * iseq,
|
vm_callee_setup_arg_complex(rb_thread_t *th, const rb_iseq_t * iseq,
|
||||||
int orig_argc, VALUE * orig_argv,
|
int orig_argc, VALUE * orig_argv,
|
||||||
const rb_block_t **block)
|
const rb_block_t **block, int *argerr)
|
||||||
{
|
{
|
||||||
const int m = iseq->argc;
|
const int m = iseq->argc;
|
||||||
int argc = orig_argc;
|
int argc = orig_argc;
|
||||||
@ -124,8 +125,11 @@ vm_callee_setup_arg_complex(rb_thread_t *th, const rb_iseq_t * iseq,
|
|||||||
|
|
||||||
/* mandatory */
|
/* mandatory */
|
||||||
if (argc < (m + iseq->arg_post_len)) { /* check with post arg */
|
if (argc < (m + iseq->arg_post_len)) { /* check with post arg */
|
||||||
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
|
*argerr = m + iseq->arg_post_len;
|
||||||
argc, m + iseq->arg_post_len);
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*argerr = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
argv += m;
|
argv += m;
|
||||||
@ -443,8 +447,9 @@ vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp,
|
|||||||
int opt_pc, i;
|
int opt_pc, i;
|
||||||
VALUE *sp, *rsp = cfp->sp - argc;
|
VALUE *sp, *rsp = cfp->sp - argc;
|
||||||
rb_iseq_t *iseq = me->def->body.iseq;
|
rb_iseq_t *iseq = me->def->body.iseq;
|
||||||
|
int eargc = 0;
|
||||||
|
|
||||||
VM_CALLEE_SETUP_ARG(opt_pc, th, iseq, argc, rsp, &blockptr);
|
VM_CALLEE_SETUP_ARG(opt_pc, th, iseq, argc, rsp, &blockptr, eargc);
|
||||||
|
|
||||||
/* stack overflow check */
|
/* stack overflow check */
|
||||||
CHECK_STACK_OVERFLOW(cfp, iseq->stack_max);
|
CHECK_STACK_OVERFLOW(cfp, iseq->stack_max);
|
||||||
@ -487,6 +492,9 @@ vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp,
|
|||||||
VM_FRAME_MAGIC_METHOD, recv, (VALUE) blockptr,
|
VM_FRAME_MAGIC_METHOD, recv, (VALUE) blockptr,
|
||||||
iseq->iseq_encoded + opt_pc, sp, 0, 0);
|
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
|
static inline VALUE
|
||||||
@ -886,8 +894,11 @@ vm_yield_setup_args(rb_thread_t * const th, const rb_iseq_t *iseq,
|
|||||||
|
|
||||||
if (lambda) {
|
if (lambda) {
|
||||||
/* call as method */
|
/* call as method */
|
||||||
int opt_pc;
|
int opt_pc, e;
|
||||||
VM_CALLEE_SETUP_ARG(opt_pc, th, iseq, argc, argv, &blockptr);
|
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);
|
||||||
|
}
|
||||||
return opt_pc;
|
return opt_pc;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user