* 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
This commit is contained in:
ko1 2014-09-11 10:23:36 +00:00
parent dcd1c22701
commit 51101947bb
2 changed files with 23 additions and 9 deletions

View File

@ -1,3 +1,11 @@
Thu Sep 11 19:16:39 2014 Koichi Sasada <ko1@atdot.net>
* 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().
Thu Sep 11 18:40:16 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* .gitignore: ignored temporary files and coverage results.

24
gc.c
View File

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