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

ruby-changes:35386

From: ko1 <ko1@a...>
Date: Tue, 9 Sep 2014 14:24:50 +0900 (JST)
Subject: [ruby-changes:35386] ko1:r47468 (trunk): * gc.c: fix layout of rb_objsapce_t to improve cache locality.

ko1	2014-09-09 14:24:42 +0900 (Tue, 09 Sep 2014)

  New Revision: 47468

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

  Log:
    * gc.c: fix layout of rb_objsapce_t to improve cache locality.
      newobj_of() accesses:
      (1) rb_objspace_t::flags
      (2) rb_objspace_t::eden_heap::freelist
      (3) and rb_objspace_t::eden_heap::free_pages if freelist is NULL.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47467)
+++ ChangeLog	(revision 47468)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Sep  9 14:21:50 2014  Koichi Sasada  <ko1@a...>
+
+	* gc.c: fix layout of rb_objsapce_t to improve cache locality.
+
+	  newobj_of() accesses:
+	  (1) rb_objspace_t::flags
+	  (2) rb_objspace_t::eden_heap::freelist
+	  (3) and rb_objspace_t::eden_heap::free_pages if freelist is NULL.
+
 Tue Sep  9 14:09:36 2014  Koichi Sasada  <ko1@a...>
 
 	* gc.c: move rb_objspace_t::flags::gc_stressfull after during_gc
Index: gc.c
===================================================================
--- gc.c	(revision 47467)
+++ gc.c	(revision 47468)
@@ -435,13 +435,14 @@ typedef struct mark_stack { https://github.com/ruby/ruby/blob/trunk/gc.c#L435
 } mark_stack_t;
 
 typedef struct rb_heap_struct {
-    struct heap_page *pages;
+    RVALUE *freelist;
+
     struct heap_page *free_pages;
     struct heap_page *using_page;
+    struct heap_page *pages;
     struct heap_page *sweep_pages;
     struct heap_page *pooled_pages;
 
-    RVALUE *freelist;
     size_t page_length;      /* total page count in a heap */
     size_t total_slots;      /* total slot count (page_length * HEAP_OBJ_LIMIT) */
 } rb_heap_t;
@@ -477,15 +478,15 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L478
 #endif
     } flags;
 
+    rb_heap_t eden_heap;
+    rb_heap_t tomb_heap; /* heap for zombies and ghosts */
+
     struct {
 	rb_atomic_t finalizing;
     } atomic_flags;
 
     size_t marked_objects;
 
-    rb_heap_t eden_heap;
-    rb_heap_t tomb_heap; /* heap for zombies and ghosts */
-
     struct {
 	struct heap_page **sorted;
 	size_t used;

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

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