* gc.c: rename is_dead_object() to is_dying_object().
This function is not opposite against is_live_object() because is_dying_object() does *not* check object type. * gc.c (is_dying_object): change condition. * gc.c (is_live_object): use T_NONE instead of 0. * gc.c (rb_objspace_dying_object_p): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ad92b09e82
commit
38943e80d6
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
Sun Jul 6 21:00:11 2014 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* gc.c: rename is_dead_object() to is_dying_object().
|
||||||
|
This function is not opposite against is_live_object()
|
||||||
|
because is_dying_object() does *not* check object type.
|
||||||
|
|
||||||
|
* gc.c (is_dying_object): change condition.
|
||||||
|
|
||||||
|
* gc.c (is_live_object): use T_NONE instead of 0.
|
||||||
|
|
||||||
|
* gc.c (rb_objspace_dying_object_p): added.
|
||||||
|
|
||||||
Sun Jul 6 13:37:27 2014 Koichi Sasada <ko1@atdot.net>
|
Sun Jul 6 13:37:27 2014 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* gc.c (rb_gc_register_mark_object): change data structure.
|
* gc.c (rb_gc_register_mark_object): change data structure.
|
||||||
|
33
gc.c
33
gc.c
@ -2330,22 +2330,34 @@ is_swept_object(rb_objspace_t *objspace, VALUE ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
is_dead_object(rb_objspace_t *objspace, VALUE ptr)
|
is_dying_object(rb_objspace_t *objspace, VALUE ptr)
|
||||||
{
|
{
|
||||||
if (!is_lazy_sweeping(heap_eden) || MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(ptr), ptr)) return FALSE;
|
if (!is_lazy_sweeping(heap_eden) ||
|
||||||
if (!is_swept_object(objspace, ptr)) return TRUE;
|
!is_swept_object(objspace, ptr) ||
|
||||||
return FALSE;
|
MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(ptr), ptr)) {
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
is_live_object(rb_objspace_t *objspace, VALUE ptr)
|
is_live_object(rb_objspace_t *objspace, VALUE ptr)
|
||||||
{
|
{
|
||||||
switch (BUILTIN_TYPE(ptr)) {
|
switch (BUILTIN_TYPE(ptr)) {
|
||||||
case 0: case T_ZOMBIE:
|
case T_NONE:
|
||||||
|
case T_ZOMBIE:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (is_dead_object(objspace, ptr)) return FALSE;
|
|
||||||
return TRUE;
|
if (is_dying_object(objspace, ptr)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
@ -2369,6 +2381,13 @@ rb_objspace_markable_object_p(VALUE obj)
|
|||||||
return is_markable_object(objspace, obj) && is_live_object(objspace, obj);
|
return is_markable_object(objspace, obj) && is_live_object(objspace, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
rb_objspace_dying_object_p(VALUE obj)
|
||||||
|
{
|
||||||
|
rb_objspace_t *objspace = &rb_objspace;
|
||||||
|
return is_dying_object(objspace, obj);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* ObjectSpace._id2ref(object_id) -> an_object
|
* ObjectSpace._id2ref(object_id) -> an_object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user