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

ruby-changes:38025

From: nobu <ko1@a...>
Date: Sat, 28 Mar 2015 14:22:27 +0900 (JST)
Subject: [ruby-changes:38025] nobu:r50106 (trunk): vm_eval.c: simplify

nobu	2015-03-28 14:22:04 +0900 (Sat, 28 Mar 2015)

  New Revision: 50106

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

  Log:
    vm_eval.c: simplify
    
    * vm_eval.c (rb_iterate0): simplify TAG_BREAK and TAG_RETRY by
      sharing common code.

  Modified files:
    trunk/vm_eval.c
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 50105)
+++ vm_eval.c	(revision 50106)
@@ -1130,34 +1130,22 @@ rb_iterate(VALUE (* it_proc) (VALUE), VA https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1130
 	}
 	retval = (*it_proc) (data1);
     }
-    else {
-	const struct vm_throw_data *err = (struct vm_throw_data *)th->errinfo;
-	if (state == TAG_BREAK) {
-	    const rb_control_frame_t *escape_cfp = THROW_DATA_CATCH_FRAME(err);
+    else if (state == TAG_BREAK || state == TAG_RETRY) {
+	const struct vm_throw_data *const err = (struct vm_throw_data *)th->errinfo;
+	const rb_control_frame_t *const escape_cfp = THROW_DATA_CATCH_FRAME(err);
 
-	    if (cfp == escape_cfp) {
-		state = 0;
-		th->state = 0;
-		th->errinfo = Qnil;
-		retval = THROW_DATA_VAL(err);
+	if (cfp == escape_cfp) {
+	    rb_vm_rewind_cfp(th, cfp);
 
-		rb_vm_rewind_cfp(th, cfp);
-	    }
-	    else if (0) {
-		SDR(); fprintf(stderr, "%p, %p\n", cfp, escape_cfp);
-	    }
-	}
-	else if (state == TAG_RETRY) {
-	    const rb_control_frame_t *escape_cfp = THROW_DATA_CATCH_FRAME(err);
-
-	    if (cfp == escape_cfp) {
-		rb_vm_rewind_cfp(th, cfp);
+	    state = 0;
+	    th->state = 0;
+	    th->errinfo = Qnil;
 
-		state = 0;
-		th->state = 0;
-		th->errinfo = Qnil;
-		goto iter_retry;
-	    }
+	    if (state == TAG_RETRY) goto iter_retry;
+	    retval = THROW_DATA_VAL(err);
+	}
+	else if (0) {
+	    SDR(); fprintf(stderr, "%p, %p\n", cfp, escape_cfp);
 	}
     }
     TH_POP_TAG();

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

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