summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-13 07:08:32 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-13 07:08:32 +0000
commitd7eb7bbccef6da8951c8a2427354f87156918909 (patch)
tree71f930605110cc9737d43a282fb465f67484328d
parentd42e547ab1a487a00ccd4f71604b58e1cce060eb (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--gc.c2
-rw-r--r--test/ruby/test_gc.rb7
3 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9744322..654f971 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Wed Jul 13 16:08:08 2016 Koichi Sasada <ko1@atdot.net>
+
+ * 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@ruby-lang.org>
* math.c (_USE_MATH_DEFINES): it must be set before including internal.h
diff --git a/gc.c b/gc.c
index ebfb037..e720068 100644
--- a/gc.c
+++ b/gc.c
@@ -4694,7 +4694,7 @@ gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
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);
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index d915ae2..a5fd289 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -390,4 +390,11 @@ class TestGc < Test::Unit::TestCase
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