From 7f7360a885974e64f27cad05f27f87eaf595caa8 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 16 Aug 2016 04:29:37 +0000 Subject: [PATCH] merge revision(s) 55663: [Backport #12583] * 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/branches/ruby_2_3@55919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 10 ++++++++++ gc.c | 2 +- test/ruby/test_gc.rb | 7 +++++++ version.h | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9cea867b3..51313d084a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Tue Aug 16 12:27:48 2016 Koichi Sasada + + * 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. + Tue Aug 16 12:01:35 2016 Naohisa Goto * ext/digest/md5/md5ossl.h: Remove excess semicolons. diff --git a/gc.c b/gc.c index c1e8cf8fbc..8a345db0cc 100644 --- a/gc.c +++ b/gc.c @@ -4642,7 +4642,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 0e3ae4bc42..51b17c6f82 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -397,4 +397,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 diff --git a/version.h b/version.h index 31265388e3..573105f1a2 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.2" #define RUBY_RELEASE_DATE "2016-08-16" -#define RUBY_PATCHLEVEL 166 +#define RUBY_PATCHLEVEL 167 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 8