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

ruby-changes:26779

From: usa <ko1@a...>
Date: Tue, 15 Jan 2013 16:31:46 +0900 (JST)
Subject: [ruby-changes:26779] usa:r38831 (ruby_1_9_3): merge revision(s) 38010: [Backport #7452]

usa	2013-01-15 16:29:28 +0900 (Tue, 15 Jan 2013)

  New Revision: 38831

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

  Log:
    merge revision(s) 38010: [Backport #7452]
    
    * gc.c (rb_objspace_call_finalizer): finalize_deferred may free up
      a object which is reachable from a part after this function,
      e.g. ruby_vm_destruct(). [ruby-dev:46647] [Bug #7452]
    
    * test/ruby/test_gc.rb (test_finalizing_main_thread): add a test
      for above.
    
    * test/rdoc/test_rdoc_servlet.rb:  Tets for above

  Modified directories:
    branches/ruby_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/gc.c
    branches/ruby_1_9_3/test/ruby/test_gc.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 38830)
+++ ruby_1_9_3/ChangeLog	(revision 38831)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Tue Jan 15 16:25:35 2013  Narihiro Nakamura  <authornari@g...>
+
+	* gc.c (rb_objspace_call_finalizer): finalize_deferred may free up
+	  a object which is reachable from a part after this function,
+	  e.g. ruby_vm_destruct(). [ruby-dev:46647] [Bug #7452]
+
+	* test/ruby/test_gc.rb (test_finalizing_main_thread): add a test
+	  for above.
+
 Tue Jan 15 16:23:30 2013  NARUSE, Yui  <naruse@r...>
 
 	* lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
Index: ruby_1_9_3/gc.c
===================================================================
--- ruby_1_9_3/gc.c	(revision 38830)
+++ ruby_1_9_3/gc.c	(revision 38831)
@@ -25,6 +25,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/gc.c#L25
 #include <stdio.h>
 #include <setjmp.h>
 #include <sys/types.h>
+#include <assert.h>
 
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
@@ -3101,18 +3102,12 @@ rb_objspace_call_finalizer(rb_objspace_t https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/gc.c#L3102
     RVALUE *final_list = 0;
     size_t i;
 
-    /* run finalizers */
     rest_sweep(objspace);
 
-    do {
-	/* XXX: this loop will make no sense */
-	/* because mark will not be removed */
-	finalize_deferred(objspace);
-	mark_tbl(objspace, finalizer_table);
-	gc_mark_stacked_objects(objspace);
-	st_foreach(finalizer_table, chain_finalized_object,
-		   (st_data_t)&deferred_final_list);
-    } while (deferred_final_list);
+    /* run finalizers */
+    finalize_deferred(objspace);
+    assert(deferred_final_list == 0);
+
     /* force to run finalizer */
     while (finalizer_table->num_entries) {
 	struct force_finalize_list *list = 0;
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 38830)
+++ ruby_1_9_3/version.h	(revision 38831)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 371
+#define RUBY_PATCHLEVEL 372
 
 #define RUBY_RELEASE_DATE "2013-01-15"
 #define RUBY_RELEASE_YEAR 2013
Index: ruby_1_9_3/test/ruby/test_gc.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_gc.rb	(revision 38830)
+++ ruby_1_9_3/test/ruby/test_gc.rb	(revision 38831)
@@ -106,4 +106,10 @@ class TestGc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_gc.rb#L106
   ensure
     GC::Profiler.disable
   end
+
+  def test_finalizing_main_thread
+    assert_in_out_err(%w[--disable-gems], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]")
+      ObjectSpace.define_finalizer(Thread.main) { p 'finalize' }
+    EOS
+  end
 end

Property changes on: ruby_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r38010


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

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