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

ruby-changes:43590

From: ko1 <ko1@a...>
Date: Wed, 13 Jul 2016 16:08:37 +0900 (JST)
Subject: [ruby-changes:43590] ko1:r55663 (trunk): * gc.c (gc_mark_roots): should mark the VM object itself to mark

ko1	2016-07-13 16:08:32 +0900 (Wed, 13 Jul 2016)

  New Revision: 55663

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

  Log:
    * gc.c (gc_mark_roots): should mark the VM object itself to mark
      singleton class of the VM object.
      Before this patch, we only set mark bit for the VM object and
      invoke mark function separately.
      [Bug #12583]
    
    * test/ruby/test_gc.rb: add a test.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/test/ruby/test_gc.rb
Index: test/ruby/test_gc.rb
===================================================================
--- test/ruby/test_gc.rb	(revision 55662)
+++ test/ruby/test_gc.rb	(revision 55663)
@@ -390,4 +390,11 @@ class TestGc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_gc.rb#L390
       GC.enable unless disabled
     end
   end
+
+  def test_vm_object
+    assert_normal_exit <<-'end', '[Bug #12583]'
+      ObjectSpace.each_object{|o| o.singleton_class rescue 0}
+      ObjectSpace.each_object{|o| case o when Module then o.instance_methods end}
+    end
+  end
 end
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55662)
+++ ChangeLog	(revision 55663)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jul 13 16:08:08 2016  Koichi Sasada  <ko1@a...>
+
+	* gc.c (gc_mark_roots): should mark the VM object itself to mark
+	  singleton class of the VM object.
+	  Before this patch, we only set mark bit for the VM object and
+	  invoke mark function separately.
+	  [Bug #12583]
+
+	* test/ruby/test_gc.rb: add a test.
+
 Wed Jul 13 15:59:59 2016  NAKAMURA Usaku  <usa@r...>
 
 	* math.c (_USE_MATH_DEFINES): it must be set before including internal.h
Index: gc.c
===================================================================
--- gc.c	(revision 55662)
+++ gc.c	(revision 55663)
@@ -4694,7 +4694,7 @@ gc_mark_roots(rb_objspace_t *objspace, c https://github.com/ruby/ruby/blob/trunk/gc.c#L4694
     MARK_CHECKPOINT("vm");
     SET_STACK_END;
     rb_vm_mark(th->vm);
-    if (th->vm->self) gc_mark_set(objspace, th->vm->self);
+    if (th->vm->self) gc_mark(objspace, th->vm->self);
 
     MARK_CHECKPOINT("finalizers");
     mark_tbl(objspace, finalizer_table);

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

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