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

ruby-changes:35387

From: ko1 <ko1@a...>
Date: Tue, 9 Sep 2014 15:01:13 +0900 (JST)
Subject: [ruby-changes:35387] ko1:r47469 (trunk): * gc.c: continue layout changing.

ko1	2014-09-09 15:00:57 +0900 (Tue, 09 Sep 2014)

  New Revision: 47469

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

  Log:
    * gc.c: continue layout changing.
      newobj_of() also touch:
      (4) increment total_allocated_object_num
      (5) check hook_events
      And gather fields related to marking phase.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47468)
+++ ChangeLog	(revision 47469)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Sep  9 14:56:03 2014  Koichi Sasada  <ko1@a...>
+
+	* gc.c: continue layout changing.
+
+	  newobj_of() also touch:
+	  (4) increment total_allocated_object_num
+	  (5) check hook_events
+
+	  And gather fields related to marking phase.
+
 Tue Sep  9 14:21:50 2014  Koichi Sasada  <ko1@a...>
 
 	* gc.c: fix layout of rb_objsapce_t to improve cache locality.
Index: gc.c
===================================================================
--- gc.c	(revision 47468)
+++ gc.c	(revision 47469)
@@ -478,6 +478,9 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L478
 #endif
     } flags;
 
+    rb_event_flag_t hook_events;
+    size_t total_allocated_object_num;
+
     rb_heap_t eden_heap;
     rb_heap_t tomb_heap; /* heap for zombies and ghosts */
 
@@ -485,6 +488,12 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L488
 	rb_atomic_t finalizing;
     } atomic_flags;
 
+    struct mark_func_data_struct {
+	void *data;
+	void (*mark_func)(VALUE v, void *data);
+    } *mark_func_data;
+
+    mark_stack_t mark_stack;
     size_t marked_objects;
 
     struct {
@@ -506,7 +515,7 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L515
     } heap_pages;
 
     st_table *finalizer_table;
-    mark_stack_t mark_stack;
+
     struct {
 	int run;
 	int latest_gc_info;
@@ -549,16 +558,9 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L558
 
 	/* basic statistics */
 	size_t count;
-	size_t total_allocated_object_num;
 	size_t total_freed_object_num;
     } profile;
     struct gc_list *global_list;
-    rb_event_flag_t hook_events; /* this place may be affinity with memory cache */
-
-    struct mark_func_data_struct {
-	void *data;
-	void (*mark_func)(VALUE v, void *data);
-    } *mark_func_data;
 
     VALUE gc_stress_mode;
 
@@ -1662,7 +1664,7 @@ newobj_of(VALUE klass, VALUE flags, VALU https://github.com/ruby/ruby/blob/trunk/gc.c#L1664
     if (rgengc_remembered(objspace, (VALUE)obj)) rb_bug("newobj: %s is remembered.", obj_info(obj));
 #endif
 
-    objspace->profile.total_allocated_object_num++;
+    objspace->total_allocated_object_num++;
     gc_event_hook(objspace, RUBY_INTERNAL_EVENT_NEWOBJ, obj);
 
     return obj;
@@ -3033,7 +3035,7 @@ count_objects(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/gc.c#L3035
 static size_t
 objspace_live_slot(rb_objspace_t *objspace)
 {
-    return objspace->profile.total_allocated_object_num - objspace->profile.total_freed_object_num - heap_pages_final_slots;
+    return objspace->total_allocated_object_num - objspace->profile.total_freed_object_num - heap_pages_final_slots;
 }
 
 static size_t
@@ -5846,7 +5848,7 @@ gc_start(rb_objspace_t *objspace, const https://github.com/ruby/ruby/blob/trunk/gc.c#L5848
 
     objspace->profile.count++;
     objspace->profile.latest_gc_info = reason;
-    objspace->profile.total_allocated_object_num_at_gc_start = objspace->profile.total_allocated_object_num;
+    objspace->profile.total_allocated_object_num_at_gc_start = objspace->total_allocated_object_num;
     objspace->profile.heap_used_at_gc_start = heap_pages_used;
     gc_prof_setup_new_record(objspace, reason);
     gc_reset_malloc_info(objspace);
@@ -6358,7 +6360,7 @@ gc_stat_internal(VALUE hash_or_sym) https://github.com/ruby/ruby/blob/trunk/gc.c#L6360
     SET(heap_swept_slot, heap_pages_swept_slots);
     SET(heap_eden_page_length, heap_eden->page_length);
     SET(heap_tomb_page_length, heap_tomb->page_length);
-    SET(total_allocated_object, objspace->profile.total_allocated_object_num);
+    SET(total_allocated_object, objspace->total_allocated_object_num);
     SET(total_freed_object, objspace->profile.total_freed_object_num);
     SET(malloc_increase, malloc_increase);
     SET(malloc_limit, malloc_limit);

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

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