diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-18 02:17:59 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-18 02:17:59 +0000 |
commit | 17cd5ac4af3b8aaec568e41e5531af65cd1adf45 (patch) | |
tree | c3a5c60a036ed49fd2c322adb8341c4e016a056f | |
parent | 84608b13622a4774c8015f8942db863820c0f81b (diff) | |
download | ruby-17cd5ac4af3b8aaec568e41e5531af65cd1adf45.tar.gz |
* gc.c (gc_mark_maybe): check to skip T_NONE.
* gc.c (markable_object_p): do not need to check (flags == 0) here.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gc.c | 22 |
2 files changed, 20 insertions, 8 deletions
@@ -1,3 +1,9 @@ +Tue Jun 18 11:02:18 2013 Koichi Sasada <ko1@atdot.net> + + * gc.c (gc_mark_maybe): check to skip T_NONE. + + * gc.c (markable_object_p): do not need to check (flags == 0) here. + Tue Jun 18 10:17:37 2013 Koichi Sasada <ko1@atdot.net> * variable.c (rb_autoload): fix WB miss. @@ -2916,9 +2916,11 @@ static void gc_mark_maybe(rb_objspace_t *objspace, VALUE obj) { (void)VALGRIND_MAKE_MEM_DEFINED(&obj, sizeof(obj)); - if (is_pointer_to_heap(objspace, (void *)obj) && - BUILTIN_TYPE(obj) != T_ZOMBIE) { - gc_mark(objspace, obj); + if (is_pointer_to_heap(objspace, (void *)obj)) { + int type = BUILTIN_TYPE(obj); + if (type != T_ZOMBIE && type != T_NONE) { + gc_mark(objspace, obj); + } } } @@ -2948,17 +2950,21 @@ gc_mark_ptr(rb_objspace_t *objspace, VALUE ptr) static int markable_object_p(rb_objspace_t *objspace, VALUE obj) { - if (rb_special_const_p(obj)) return 0; /* special const not marked */ - if (RBASIC(obj)->flags == 0) return 0; /* free cell */ - if (RGENGC_CHECK_MODE && BUILTIN_TYPE(obj) == T_ZOMBIE) - rb_bug("markable_object_p: %p is T_ZOMBIE", (void *)obj); + if (rb_special_const_p(obj)) return 0; /* special const is not markable */ + + if (RGENGC_CHECK_MODE) { + if (!is_pointer_to_heap(objspace, (void *)obj)) rb_bug("markable_object_p: %p is not pointer to heap", (void *)obj); + if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("markable_object_p: %p is T_NONE", (void *)obj); + if (BUILTIN_TYPE(obj) == T_ZOMBIE) rb_bug("markable_object_p: %p is T_ZOMBIE", (void *)obj); + } + return 1; } int rb_objspace_markable_object_p(VALUE obj) { - return markable_object_p(/* now it doesn't use &rb_objspace */ 0, obj); + return markable_object_p(&rb_objspace, obj); } static const char * |