From f537854ff33fce2723ac7ff46180a990b5b0df5d Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 19 Mar 2015 07:14:12 +0000 Subject: [PATCH] * gc.c (newobj_of): fix RGENGC_OLD_NEWOBJ_CHECK logics. * skip on incremental marking because not sure what happen :p * rb_gc_writebarrier_remember() is enough to mark children. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ gc.c | 8 +++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ade41d42f..0b5fcd475e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Mar 19 16:12:01 2015 Koichi Sasada + + * gc.c (newobj_of): fix RGENGC_OLD_NEWOBJ_CHECK logics. + * skip on incremental marking because not sure what happen :p + * rb_gc_writebarrier_remember() is enough to mark children. + Thu Mar 19 16:08:42 2015 Koichi Sasada * gc.c (rb_copy_wb_protected_attribute): need demote for old objects. diff --git a/gc.c b/gc.c index 8b1493fc5e..44373a4314 100644 --- a/gc.c +++ b/gc.c @@ -1748,7 +1748,8 @@ newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3) { static int newobj_cnt = RGENGC_OLD_NEWOBJ_CHECK; - if (flags & FL_WB_PROTECTED && /* do not promote WB unprotected objects */ + if (!is_incremental_marking(objspace) && + flags & FL_WB_PROTECTED && /* do not promote WB unprotected objects */ ! RB_TYPE_P(obj, T_ARRAY)) { /* array.c assumes that allocated objects are new */ if (--newobj_cnt == 0) { newobj_cnt = RGENGC_OLD_NEWOBJ_CHECK; @@ -1756,10 +1757,7 @@ newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3) gc_mark_set(objspace, obj); RVALUE_AGE_SET_OLD(objspace, obj); - if (is_pointer_to_heap(objspace, (void *)klass)) RB_OBJ_WRITTEN(obj, Qundef, klass); - if (is_pointer_to_heap(objspace, (void *)v1)) RB_OBJ_WRITTEN(obj, Qundef, v1); - if (is_pointer_to_heap(objspace, (void *)v2)) RB_OBJ_WRITTEN(obj, Qundef, v2); - if (is_pointer_to_heap(objspace, (void *)v3)) RB_OBJ_WRITTEN(obj, Qundef, v3); + rb_gc_writebarrier_remember(obj); } } }