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

ruby-changes:31234

From: ko1 <ko1@a...>
Date: Thu, 17 Oct 2013 05:41:54 +0900 (JST)
Subject: [ruby-changes:31234] ko1:r43313 (trunk): * gc.c (objspace_each_objects): do not skip empty RVALUEs.

ko1	2013-10-17 05:41:49 +0900 (Thu, 17 Oct 2013)

  New Revision: 43313

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

  Log:
    * gc.c (objspace_each_objects): do not skip empty RVALUEs.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43312)
+++ ChangeLog	(revision 43313)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Oct 17 05:40:33 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (objspace_each_objects): do not skip empty RVALUEs.
+
 Thu Oct 17 05:31:31 2013  Koichi Sasada  <ko1@a...>
 
 	* error.c (rb_bug_reporter_add): return simply 0 if failed.
Index: gc.c
===================================================================
--- gc.c	(revision 43312)
+++ gc.c	(revision 43313)
@@ -1411,16 +1411,12 @@ objspace_each_objects(VALUE arg) https://github.com/ruby/ruby/blob/trunk/gc.c#L1411
     RVALUE *pstart, *pend;
     rb_objspace_t *objspace = &rb_objspace;
     struct each_obj_args *args = (struct each_obj_args *)arg;
-    volatile VALUE v;
 
     i = 0;
     while (i < heap_used) {
-	while (0 < i && last_body < objspace->heap.sorted[i-1]->body)
-	    i--;
-	while (i < heap_used && objspace->heap.sorted[i]->body <= last_body)
-	    i++;
-	if (heap_used <= i)
-	  break;
+	while (0 < i && last_body < objspace->heap.sorted[i-1]->body)        i--;
+	while (i < heap_used && objspace->heap.sorted[i]->body <= last_body) i++;
+	if (heap_used <= i) break;
 
 	slot = objspace->heap.sorted[i];
 	last_body = slot->body;
@@ -1428,19 +1424,10 @@ objspace_each_objects(VALUE arg) https://github.com/ruby/ruby/blob/trunk/gc.c#L1424
 	pstart = slot->start;
 	pend = pstart + slot->limit;
 
-	for (; pstart != pend; pstart++) {
-	    if (pstart->as.basic.flags) {
-		v = (VALUE)pstart; /* acquire to save this object */
-		break;
-	    }
-	}
-	if (pstart != pend) {
-	    if ((*args->callback)(pstart, pend, sizeof(RVALUE), args->data)) {
-		break;
-	    }
+	if ((*args->callback)(pstart, pend, sizeof(RVALUE), args->data)) {
+	    break;
 	}
     }
-    RB_GC_GUARD(v);
 
     return Qnil;
 }

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

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