summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-11 10:23:36 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-11 10:23:36 +0000
commit51101947bb964dde5808a8a9bd8b67879498f58f (patch)
tree9877ce6eb81abf6395d62e7ea4a362ff8e9937fd /gc.c
parentdcd1c22701f839f098ff7a6afd3e82498930e3ae (diff)
* gc.c (gc_mark_ptr): rename to gc_mark_set.
* gc.c (gc_mark): add gc_mark_ptr() to skip is_markable_object() check. gc_mark_maybe() can use gc_mark_ptr() directly because passed pointer is checked by is_pointer_to_heap(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/gc.c b/gc.c
index 0f74f80d5d..3970c8334d 100644
--- a/gc.c
+++ b/gc.c
@@ -769,6 +769,7 @@ static void gc_sweep_rest(rb_objspace_t *objspace);
static void gc_sweep_continue(rb_objspace_t *objspace, rb_heap_t *heap);
static void gc_mark(rb_objspace_t *objspace, VALUE ptr);
+static void gc_mark_ptr(rb_objspace_t *objspace, VALUE ptr);
static void gc_mark_maybe(rb_objspace_t *objspace, VALUE ptr);
static void gc_mark_children(rb_objspace_t *objspace, VALUE ptr);
@@ -3855,7 +3856,7 @@ gc_mark_maybe(rb_objspace_t *objspace, VALUE 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);
+ gc_mark_ptr(objspace, obj);
}
}
}
@@ -3867,7 +3868,7 @@ rb_gc_mark_maybe(VALUE obj)
}
static inline int
-gc_mark_ptr(rb_objspace_t *objspace, VALUE obj)
+gc_mark_set(rb_objspace_t *objspace, VALUE obj)
{
if (RVALUE_MARKED(obj)) return 0;
MARK_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj);
@@ -3986,13 +3987,11 @@ gc_aging(rb_objspace_t *objspace, VALUE obj)
}
static void
-gc_mark(rb_objspace_t *objspace, VALUE obj)
+gc_mark_ptr(rb_objspace_t *objspace, VALUE obj)
{
- if (!is_markable_object(objspace, obj)) return;
-
if (LIKELY(objspace->mark_func_data == NULL)) {
rgengc_check_relation(objspace, obj);
- if (!gc_mark_ptr(objspace, obj)) return; /* already marked */
+ if (!gc_mark_set(objspace, obj)) return; /* already marked */
gc_aging(objspace, obj);
gc_grey(objspace, obj);
}
@@ -4001,6 +4000,13 @@ gc_mark(rb_objspace_t *objspace, VALUE obj)
}
}
+static void
+gc_mark(rb_objspace_t *objspace, VALUE obj)
+{
+ if (!is_markable_object(objspace, obj)) return;
+ gc_mark_ptr(objspace, obj);
+}
+
void
rb_gc_mark(VALUE ptr)
{
@@ -4299,7 +4305,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_ptr(objspace, th->vm->self);
+ if (th->vm->self) gc_mark_set(objspace, th->vm->self);
MARK_CHECKPOINT("finalizers");
mark_tbl(objspace, finalizer_table);
@@ -5329,7 +5335,7 @@ gc_mark_from(rb_objspace_t *objspace, VALUE obj, VALUE parent)
{
gc_mark_set_parent(objspace, parent);
rgengc_check_relation(objspace, obj);
- if (gc_mark_ptr(objspace, obj) == FALSE) return;
+ if (gc_mark_set(objspace, obj) == FALSE) return;
gc_aging(objspace, obj);
gc_grey(objspace, obj);
}
@@ -5393,7 +5399,7 @@ rb_gc_writebarrier_unprotect(VALUE obj)
if (RVALUE_OLD_P(obj)) {
gc_report(1, objspace, "rb_gc_writebarrier_unprotect: %s\n", obj_info(obj));
RVALUE_DEMOTE(objspace, obj);
- gc_mark_ptr(objspace, obj);
+ gc_mark_set(objspace, obj);
gc_remember_unprotected(objspace, obj);
#if RGENGC_PROFILE