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

ruby-changes:29943

From: ko1 <ko1@a...>
Date: Tue, 16 Jul 2013 15:01:07 +0900 (JST)
Subject: [ruby-changes:29943] ko1:r41995 (trunk): * gc.c (after_gc_sweep): refactoring code.

ko1	2013-07-16 15:00:55 +0900 (Tue, 16 Jul 2013)

  New Revision: 41995

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

  Log:
    * gc.c (after_gc_sweep): refactoring code.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41994)
+++ ChangeLog	(revision 41995)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul 16 14:59:09 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (after_gc_sweep): refactoring code.
+
 Tue Jul 16 13:32:06 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* encoding.c (enc_set_index): since r41967, old terminator is dealt
Index: gc.c
===================================================================
--- gc.c	(revision 41994)
+++ gc.c	(revision 41995)
@@ -2384,18 +2384,20 @@ after_gc_sweep(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L2384
 static int
 lazy_sweep(rb_objspace_t *objspace)
 {
-    struct heaps_slot *next;
+    struct heaps_slot *slot;
     int result = FALSE;
 
     gc_prof_sweep_timer_start(objspace);
 
     heaps_increment(objspace);
-    while (is_lazy_sweeping(objspace)) {
-        next = objspace->heap.sweep_slots->next;
-	slot_sweep(objspace, objspace->heap.sweep_slots);
-        objspace->heap.sweep_slots = next;
+    slot = objspace->heap.sweep_slots;
 
-	if (!next) after_gc_sweep(objspace);
+    while (slot) {
+	slot_sweep(objspace, slot);
+
+	if ((objspace->heap.sweep_slots = slot = slot->next) == NULL) {
+	    after_gc_sweep(objspace);
+	}
 
         if (has_free_object) {
             result = TRUE;

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

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