[前][次][番号順一覧][スレッド一覧]

ruby-changes:13881

From: matz <ko1@a...>
Date: Sat, 7 Nov 2009 12:51:54 +0900 (JST)
Subject: [ruby-changes:13881] Ruby:r25681 (trunk): * vm_insnhelper.c (VM_CALLEE_SETUP_ARG): revert r25521.

matz	2009-11-07 12:51:39 +0900 (Sat, 07 Nov 2009)

  New Revision: 25681

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25681

  Log:
    * vm_insnhelper.c (VM_CALLEE_SETUP_ARG): revert r25521.
       [ruby-core:26427] [ruby-core:26447]

  Modified files:
    trunk/ChangeLog
    trunk/vm_insnhelper.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25680)
+++ ChangeLog	(revision 25681)
@@ -1,3 +1,8 @@
+Sat Nov  7 12:41:19 2009  Yukihiro Matsumoto  <matz@r...>
+
+	* 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@r...>
 
 	* vm_insnhelper.c (vm_push_frame): add CHECK_STACK_OVERFLOW.
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 25680)
+++ vm_insnhelper.c	(revision 25681)
@@ -100,23 +100,22 @@
 
 /* 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,12 +126,9 @@
 
     /* mandatory */
     if (argc < (m + iseq->arg_post_len)) { /* check with post arg */
-	*argerr = m + iseq->arg_post_len;
-	return 0;
+	rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
+		 argc, m + iseq->arg_post_len);
     }
-    else {
-	*argerr = -1;
-    }
 
     argv += m;
     argc -= m;
@@ -449,9 +445,8 @@
     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_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 @@
 
     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 {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]