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

ruby-changes:31429

From: tarui <ko1@a...>
Date: Fri, 1 Nov 2013 22:47:42 +0900 (JST)
Subject: [ruby-changes:31429] tarui:r43508 (trunk): * gc.c (struct heap_page, gc_page_sweep, gc_sweep): Refactoring for

tarui	2013-11-01 22:47:39 +0900 (Fri, 01 Nov 2013)

  New Revision: 43508

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

  Log:
    * gc.c (struct heap_page, gc_page_sweep, gc_sweep): Refactoring for
      performance. Add before_sweep condition to heap_page structure.
    
    * gc.c (rb_gc_force_recycle): Use before_sweep member.
    
    * gc.c (heap_is_before_sweep, is_before_sweep): Remove. They has not
      already been used.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43507)
+++ ChangeLog	(revision 43508)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Nov  1 22:45:54 2013  Masaya Tarui  <tarui@r...>
+
+	* gc.c (struct heap_page, gc_page_sweep, gc_sweep): Refactoring for
+	  performance. Add before_sweep condition to heap_page structure.
+
+	* gc.c (rb_gc_force_recycle): Use before_sweep member.
+
+	* gc.c (heap_is_before_sweep, is_before_sweep): Remove. They has not
+	  already been used.
+
 Fri Nov  1 22:20:28 2013  Masaya Tarui  <tarui@r...>
 
 	* gc.c (make_deferred): Refactoring. Collect codes which should be
Index: gc.c
===================================================================
--- gc.c	(revision 43507)
+++ gc.c	(revision 43508)
@@ -474,6 +474,7 @@ struct heap_page { https://github.com/ruby/ruby/blob/trunk/gc.c#L474
     struct heap_page *prev;
     struct heap_page *free_next;
     rb_heap_t *heap;
+    int before_sweep;
 
     bits_t mark_bits[HEAP_BITMAP_LIMIT];
 #if USE_RGENGC
@@ -666,29 +667,6 @@ RVALUE_PROMOTE(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L667
 #endif
 }
 
-static inline int
-heap_is_before_sweep(VALUE obj, rb_heap_t *heap)
-{
-    struct heap_page *page;
-    if (is_lazy_sweeping(heap)) {
-	page = heap->sweep_pages;
-	while (page) {
-	    if (page->body == GET_PAGE_BODY(obj)) {
-		return TRUE;
-	    }
-	    page = page->next;
-	}
-    }
-    return FALSE;
-}
-
-static inline int
-is_before_sweep(VALUE obj)
-{
-    rb_objspace_t *objspace = &rb_objspace;
-    return heap_is_before_sweep(obj, heap_eden);
-}
-
 static inline void
 RVALUE_DEMOTE(VALUE obj)
 {
@@ -2383,6 +2361,8 @@ gc_page_sweep(rb_objspace_t *objspace, r https://github.com/ruby/ruby/blob/trunk/gc.c#L2361
 
     rgengc_report(1, objspace, "page_sweep: start.\n");
 
+    sweep_page->before_sweep = 0;
+
     p = sweep_page->start; pend = p + sweep_page->limit;
     offset = p - NUM_IN_PAGE(p);
     bits = GET_HEAP_MARK_BITS(p);
@@ -2664,7 +2644,13 @@ gc_sweep(rb_objspace_t *objspace, int im https://github.com/ruby/ruby/blob/trunk/gc.c#L2644
 #endif
     }
     else {
+	struct heap_page *page;
 	gc_before_sweep(objspace);
+	page = heap_eden->sweep_pages;
+	while (page) {
+	    page->before_sweep = 1;
+	    page = page->next;
+	}
 	gc_heap_lazy_sweep(objspace, heap_eden);
     }
 
@@ -4295,7 +4281,7 @@ rb_gc_force_recycle(VALUE p) https://github.com/ruby/ruby/blob/trunk/gc.c#L4281
 #if USE_RGENGC
     CLEAR_IN_BITMAP(GET_HEAP_REMEMBERSET_BITS(p), p);
     CLEAR_IN_BITMAP(GET_HEAP_OLDGEN_BITS(p), p);
-    if (!is_before_sweep(p)) {
+    if (!GET_HEAP_PAGE(p)->before_sweep) {
 	CLEAR_IN_BITMAP(GET_HEAP_MARK_BITS(p), p);
     }
 #endif

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

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