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

ruby-changes:19536

From: nagachika <ko1@a...>
Date: Sun, 15 May 2011 21:41:46 +0900 (JST)
Subject: [ruby-changes:19536] nagachika:r31577 (trunk): * cont.c (cont_init): clear macihne_stack_start/end of saved thread to

nagachika	2011-05-15 21:41:40 +0900 (Sun, 15 May 2011)

  New Revision: 31577

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

  Log:
    * cont.c (cont_init): clear macihne_stack_start/end of saved thread to
       prevent mark machine stack of GC'ed Thread. root Fiber is not initialized by
       fiber_init(). based on a patch by Serge Balyuk [ruby-core:35891] fixes #4612
     * test/ruby/test_fiber.rb (test_gc_root_fiber): add test for it.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31576)
+++ ChangeLog	(revision 31577)
@@ -1,3 +1,10 @@
+Sun May 15 21:22:35 2011  CHIKANAGA Tomoyuki  <nagachika00@g...>
+
+	* cont.c (cont_init): clear macihne_stack_start/end of saved thread to
+	  prevent mark machine stack of GC'ed Thread. root Fiber is not initialized by
+	  fiber_init(). based on a patch by Serge Balyuk [ruby-core:35891] fixes #4612
+	* test/ruby/test_fiber.rb (test_gc_root_fiber): add test for it.
+
 Sun May 15 21:04:29 2011  Nobuyoshi Nakada  <nobu@r...>
 
 	* transcode.c (econv_init): revert r31353.  [ruby-dev:43512]
Index: cont.c
===================================================================
--- cont.c	(revision 31576)
+++ cont.c	(revision 31577)
@@ -383,6 +383,7 @@
     /* save thread context */
     cont->saved_thread = *th;
     cont->saved_thread.local_storage = 0;
+    cont->saved_thread.machine_stack_start = cont->saved_thread.machine_stack_end = 0;
 }
 
 static rb_context_t *
Index: test/ruby/test_fiber.rb
===================================================================
--- test/ruby/test_fiber.rb	(revision 31576)
+++ test/ruby/test_fiber.rb	(revision 31577)
@@ -197,5 +197,16 @@
       end.join
     end
   end
+
+  def test_gc_root_fiber
+    bug4612 = '[ruby-core:35891]'
+
+    assert_normal_exit %q{
+      require 'fiber'
+      GC.stress = true
+      Thread.start{ Fiber.current; nil }.join
+      GC.start
+    }, bug4612
+  end
 end
 

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

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