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

ruby-changes:14768

From: nobu <ko1@a...>
Date: Wed, 10 Feb 2010 04:12:02 +0900 (JST)
Subject: [ruby-changes:14768] Ruby:r26628 (trunk): * vm.c (vm_exec): reset thread state before starting vm loop.

nobu	2010-02-10 04:06:39 +0900 (Wed, 10 Feb 2010)

  New Revision: 26628

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

  Log:
    * vm.c (vm_exec): reset thread state before starting vm loop.
      [ruby-core:28129]

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/test_flow.rb
    trunk/vm.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 26627)
+++ ChangeLog	(revision 26628)
@@ -1,3 +1,8 @@
+Wed Feb 10 04:06:36 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm.c (vm_exec): reset thread state before starting vm loop.
+	  [ruby-core:28129]
+
 Tue Feb  9 23:48:25 2010  Yusuke Endoh  <mame@t...>
 
 	* ext/bigdecimal/bigdecimal.c (BigDecimal_divide): fix precision too.
Index: bootstraptest/test_flow.rb
===================================================================
--- bootstraptest/test_flow.rb	(revision 26627)
+++ bootstraptest/test_flow.rb	(revision 26628)
@@ -502,3 +502,24 @@
   test
 }, '[ruby-dev:37967]'
 
+[['[ruby-core:28129]', %q{
+  class Bug2728
+    include Enumerable
+    define_method(:dynamic_method) do
+      "dynamically defined method"
+    end
+    def each
+      begin
+        yield :foo
+      ensure
+        dynamic_method
+      end
+    end
+  end
+  e = Bug2728.new
+}]].each do |bug, src|
+  assert_equal "foo", src + %q{e.detect {true}}, bug
+  assert_equal "true", src + %q{e.any? {true}}, bug
+  assert_equal "false", src + %q{e.all? {false}}, bug
+  assert_equal "true", src + %q{e.include?(:foo)}, bug
+end
Index: vm.c
===================================================================
--- vm.c	(revision 26627)
+++ vm.c	(revision 26628)
@@ -1121,6 +1121,8 @@
     _tag.retval = Qnil;
     if ((state = EXEC_TAG()) == 0) {
       vm_loop_start:
+	th->state = 0;
+	th->errinfo = Qnil;
 	result = vm_exec_core(th, initial);
 	if ((state = th->state) != 0) {
 	    err = result;
@@ -1189,7 +1191,6 @@
 #else
 		    *th->cfp->sp++ = (GET_THROWOBJ_VAL(err));
 #endif
-		    th->errinfo = Qnil;
 		    goto vm_loop_start;
 		}
 	    }
@@ -1226,7 +1227,6 @@
 			escape_dfp = GET_THROWOBJ_CATCH_POINT(err);
 			if (cfp->dfp == escape_dfp) {
 			    cfp->pc = cfp->iseq->iseq_encoded + entry->cont;
-			    th->errinfo = Qnil;
 			    goto vm_loop_start;
 			}
 		    }
@@ -1258,7 +1258,6 @@
 			    *th->cfp->sp++ = (GET_THROWOBJ_VAL(err));
 #endif
 			}
-			th->errinfo = Qnil;
 			goto vm_loop_start;
 		    }
 		}
@@ -1302,8 +1301,6 @@
 			  cfp->self, (VALUE)cfp->dfp, catch_iseq->iseq_encoded,
 			  cfp->sp + 1 /* push value */, cfp->lfp, catch_iseq->local_size - 1);
 
-	    state = 0;
-	    th->errinfo = Qnil;
 	    goto vm_loop_start;
 	}
 	else {

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

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