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

ruby-changes:26499

From: nagachika <ko1@a...>
Date: Sat, 22 Dec 2012 15:46:33 +0900 (JST)
Subject: [ruby-changes:26499] nagachika:r38550 (trunk): * cont.c (rb_fiber_start): in case of jump with TAG_FATAL,

nagachika	2012-12-22 15:45:28 +0900 (Sat, 22 Dec 2012)

  New Revision: 38550

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

  Log:
    * cont.c (rb_fiber_start): in case of jump with TAG_FATAL,
      enqueue error into async_errinfo_queue, because you cannot call
      TH_TAG_JUMP() in this function. [ruby-dev:45218]  [Bug #5993]
    
    * thread.c (rb_threadptr_execute_interrupts): now INT2FIX(TAG_FATAL)
      can be popped from async_errinfo_queue.
    
    * vm.c (rb_vm_make_jump_tag_but_local_jump): revert r38441.
      rb_vm_make_jump_tag_but_local_jump() shouldn't return exception
      in case of state == TAG_FATAL.
    
    * test/ruby/test_fiber.rb (test_exit_in_fiber): fix a test to illuminate
      Thread.exit should terminate current Thread.

  Modified files:
    trunk/ChangeLog
    trunk/cont.c
    trunk/test/ruby/test_fiber.rb
    trunk/thread.c
    trunk/vm.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38549)
+++ ChangeLog	(revision 38550)
@@ -1,3 +1,19 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Dec 19 02:34:48 2012  CHIKANAGA Tomoyuki  <nagachika@r...>
+
+	* cont.c (rb_fiber_start): in case of jump with TAG_FATAL,
+	  enqueue error into async_errinfo_queue, because you cannot call
+	  TH_TAG_JUMP() in this function. [ruby-dev:45218]  [Bug #5993]
+
+	* thread.c (rb_threadptr_execute_interrupts): now INT2FIX(TAG_FATAL)
+	  can be popped from async_errinfo_queue.
+
+	* vm.c (rb_vm_make_jump_tag_but_local_jump): revert r38441.
+	  rb_vm_make_jump_tag_but_local_jump() shouldn't return exception
+	  in case of state == TAG_FATAL.
+
+	* test/ruby/test_fiber.rb (test_exit_in_fiber): fix a test to illuminate
+	  Thread.exit should terminate current Thread.
+
 Sat Dec 22 13:15:08 2012  Hiroshi Shirosaki  <h.shirosaki@g...>
 
 	* gc.c (obj_id_to_ref): add a macro to treat Bignum object id.
Index: thread.c
===================================================================
--- thread.c	(revision 38549)
+++ thread.c	(revision 38550)
@@ -1834,8 +1834,9 @@ rb_threadptr_execute_interrupts(rb_threa https://github.com/ruby/ruby/blob/trunk/thread.c#L1834
 	    if (err == Qundef) {
 		/* no error */
 	    }
-	    else if (err == eKillSignal      /* Thread#kill receieved */  ||
-		     err == eTerminateSignal /* Terminate thread */ ) {
+	    else if (err == eKillSignal        /* Thread#kill receieved */  ||
+		     err == eTerminateSignal   /* Terminate thread */       ||
+		     err == INT2FIX(TAG_FATAL) /* Thread.exit etc. */         ) {
 		rb_threadptr_to_kill(th);
 	    }
 	    else {
Index: cont.c
===================================================================
--- cont.c	(revision 38549)
+++ cont.c	(revision 38550)
@@ -1164,6 +1164,9 @@ rb_fiber_start(void) https://github.com/ruby/ruby/blob/trunk/cont.c#L1164
 	if (state == TAG_RAISE) {
 	    rb_threadptr_async_errinfo_enque(th, th->errinfo);
 	}
+	else if (state == TAG_FATAL) {
+	    rb_threadptr_async_errinfo_enque(th, th->errinfo);
+	}
 	else {
 	    VALUE err = rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
 	    if (!NIL_P(err))
Index: vm.c
===================================================================
--- vm.c	(revision 38549)
+++ vm.c	(revision 38550)
@@ -917,11 +917,6 @@ rb_vm_make_jump_tag_but_local_jump(int s https://github.com/ruby/ruby/blob/trunk/vm.c#L917
       case TAG_RETRY:
 	result = make_localjump_error("retry outside of rescue clause", Qnil, state);
 	break;
-      case TAG_FATAL:
-	/* internal exception or Thread.exit */
-	/* Thread.exit set th->errinfo to INT2FIX(TAG_FATAL) */
-	if (!FIXNUM_P(val))
-	    result = val;
       default:
 	break;
     }
Index: test/ruby/test_fiber.rb
===================================================================
--- test/ruby/test_fiber.rb	(revision 38549)
+++ test/ruby/test_fiber.rb	(revision 38550)
@@ -267,7 +267,7 @@ if false https://github.com/ruby/ruby/blob/trunk/test/ruby/test_fiber.rb#L267
   def test_exit_in_fiber
     bug5993 = '[ruby-dev:45218]'
     assert_nothing_raised(bug5993) do
-      Thread.new{ Fiber.new{ Thread.exit }.resume }.join
+      Thread.new{ Fiber.new{ Thread.exit }.resume; raise "unreachable" }.join
     end
   end
 

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

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