summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-25 05:12:06 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-25 05:12:06 +0000
commit41929aa6b60dd975bbb162a7d0a3cde11e2de6a8 (patch)
tree77fa4f53b8d7de6b763a4b8f333cf46114e9411f /gc.c
parent61a28934578f067f36f632f5a386366143798a69 (diff)
* gc.c: change objspace::rgengc::parent_object_is_old (boolean)
to objspace::rgengc::parent_object (VALUE). Use Qfalse or RVALUE pointer instead of FALSE and TRUE. * gc.c (gc_marks_body): should clear parent_object just before gc_mark_roots() because there are no parents objects for root objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/gc.c b/gc.c
index c2e015dc6b..ae3f570ad1 100644
--- a/gc.c
+++ b/gc.c
@@ -526,13 +526,10 @@ typedef struct rb_objspace {
#if USE_RGENGC
struct {
+ VALUE parent_object;
int during_minor_gc;
- int parent_object_is_old;
-
int need_major_gc;
-
size_t last_major_gc;
-
size_t remembered_shady_object_count;
size_t remembered_shady_object_limit;
size_t old_object_count;
@@ -3667,7 +3664,7 @@ static void
rgengc_check_relation(rb_objspace_t *objspace, VALUE obj)
{
#if USE_RGENGC
- if (objspace->rgengc.parent_object_is_old) {
+ if (objspace->rgengc.parent_object) {
if (!RVALUE_WB_PROTECTED(obj)) {
if (rgengc_remember(objspace, obj)) {
objspace->rgengc.remembered_shady_object_count++;
@@ -3784,14 +3781,14 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
/* infant -> young */
RVALUE_PROMOTE_INFANT(objspace, (VALUE)obj, TRUE);
#if RGENGC_AGE2_PROMOTION
- objspace->rgengc.parent_object_is_old = FALSE;
+ objspace->rgengc.parent_object = Qfalse;
#else
- objspace->rgengc.parent_object_is_old = TRUE;
+ objspace->rgengc.parent_object = (VALUE)obj;
#endif
rgengc_report(3, objspace, "gc_mark_children: promote infant -> young %p (%s).\n", (void *)obj, obj_type_name((VALUE)obj));
}
else {
- objspace->rgengc.parent_object_is_old = TRUE;
+ objspace->rgengc.parent_object = (VALUE)obj;
#if RGENGC_AGE2_PROMOTION
if (RVALUE_YOUNG_P((VALUE)obj)) {
@@ -3812,7 +3809,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
}
else {
rgengc_report(3, objspace, "gc_mark_children: do not promote non-WB-protected %p (%s).\n", (void *)obj, obj_type_name((VALUE)obj));
- objspace->rgengc.parent_object_is_old = FALSE;
+ objspace->rgengc.parent_object = Qfalse;
}
}
@@ -4263,7 +4260,6 @@ gc_marks_body(rb_objspace_t *objspace, int full_mark)
rgengc_report(1, objspace, "gc_marks_body: start (%s)\n", full_mark ? "full" : "minor");
#if USE_RGENGC
- objspace->rgengc.parent_object_is_old = FALSE;
objspace->rgengc.during_minor_gc = full_mark ? FALSE : TRUE;
#if RGENGC_AGE2_PROMOTION
@@ -4281,6 +4277,8 @@ gc_marks_body(rb_objspace_t *objspace, int full_mark)
objspace->rgengc.last_major_gc = objspace->profile.count;
rgengc_mark_and_rememberset_clear(objspace, heap_eden);
}
+
+ objspace->rgengc.parent_object = Qfalse; /* should clear just before gc_mark_roots() */
#endif
gc_mark_roots(objspace, full_mark, 0);