1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ko1 2013-06-18 02:17:59 +00:00
parent 84608b1362
commit 17cd5ac4af
2 changed files with 20 additions and 8 deletions

View file

@ -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.

22
gc.c
View file

@ -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 *