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

ruby-changes:31344

From: tarui <ko1@a...>
Date: Sat, 26 Oct 2013 06:37:46 +0900 (JST)
Subject: [ruby-changes:31344] tarui:r43423 (trunk): * gc.c (gc_before_heap_sweep): Restructure code to mean clearly.

tarui	2013-10-26 06:37:39 +0900 (Sat, 26 Oct 2013)

  New Revision: 43423

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

  Log:
    * gc.c (gc_before_heap_sweep): Restructure code to mean clearly.
      heap->freelist is connected to end of list.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43422)
+++ ChangeLog	(revision 43423)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Oct 26 06:35:41 2013  Masaya Tarui  <tarui@r...>
+
+	* gc.c (gc_before_heap_sweep): Restructure code to mean clearly.
+	  heap->freelist is connected to end of list.
+
 Sat Oct 26 04:01:35 2013  Koichi Sasada  <ko1@a...>
 
 	* gc.c (gc_before_heap_sweep): fix freelist management.
Index: gc.c
===================================================================
--- gc.c	(revision 43422)
+++ gc.c	(revision 43423)
@@ -2483,18 +2483,11 @@ gc_before_heap_sweep(rb_objspace_t *objs https://github.com/ruby/ruby/blob/trunk/gc.c#L2483
     heap->free_pages = NULL;
 
     if (heap->using_page) {
-	if (heap->using_page->freelist) {
-	    RVALUE *pstart = heap->using_page->freelist;
-	    RVALUE *p = heap->using_page->freelist;
-	    while (p->as.free.next) {
-		p = p->as.free.next;
-	    }
-	    p->as.free.next = heap->freelist;
-	    heap->using_page->freelist = pstart;
-	}
-	else {
-	    heap->using_page->freelist = heap->freelist;
+	RVALUE **p = &heap->using_page->freelist;
+	while (*p) {
+	    p = &(*p)->as.free.next;
 	}
+	*p = heap->freelist;
 	heap->using_page = NULL;
     }
     heap->freelist = NULL;

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

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