[前][次][番号順一覧][スレッド一覧]

ruby-changes:34856

From: ko1 <ko1@a...>
Date: Fri, 25 Jul 2014 14:12:13 +0900 (JST)
Subject: [ruby-changes:34856] ko1:r46939 (trunk): * gc.c: change objspace::rgengc::parent_object_is_old (boolean)

ko1	2014-07-25 14:12:06 +0900 (Fri, 25 Jul 2014)

  New Revision: 46939

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46939

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46938)
+++ ChangeLog	(revision 46939)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jul 25 14:07:27 2014  Koichi Sasada  <ko1@a...>
+
+	* 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.
+
 Fri Jul 25 13:45:39 2014  Koichi Sasada  <ko1@a...>
 
 	* gc.c (rb_gc_writebarrier_remember_promoted): should remember only
Index: gc.c
===================================================================
--- gc.c	(revision 46938)
+++ gc.c	(revision 46939)
@@ -526,13 +526,10 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L526
 
 #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 https://github.com/ruby/ruby/blob/trunk/gc.c#L3664
 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 https://github.com/ruby/ruby/blob/trunk/gc.c#L3781
 		/* 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 https://github.com/ruby/ruby/blob/trunk/gc.c#L3809
 	}
 	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, i https://github.com/ruby/ruby/blob/trunk/gc.c#L4260
     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, i https://github.com/ruby/ruby/blob/trunk/gc.c#L4277
 	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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]