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

ruby-changes:29474

From: ko1 <ko1@a...>
Date: Fri, 21 Jun 2013 15:29:40 +0900 (JST)
Subject: [ruby-changes:29474] ko1:r41526 (trunk): * gc.c (gc_sweep): profile sweep time correctly when LAZY_SWEEP is

ko1	2013-06-21 15:29:30 +0900 (Fri, 21 Jun 2013)

  New Revision: 41526

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

  Log:
    * gc.c (gc_sweep): profile sweep time correctly when LAZY_SWEEP is
      disabled.
    * gc.c (gc_marks_test): store oldgen count and shady count
      before test marking and restore them after marking.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41525)
+++ ChangeLog	(revision 41526)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun 21 15:26:45 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (gc_sweep): profile sweep time correctly when LAZY_SWEEP is
+	  disabled.
+
+	* gc.c (gc_marks_test): store oldgen count and shady count
+	  before test marking and restore them after marking.
+
 Fri Jun 21 15:07:42 2013  Koichi Sasada  <ko1@a...>
 
 	* gc.c: enable lazy sweep (commit miss).
Index: gc.c
===================================================================
--- gc.c	(revision 41525)
+++ gc.c	(revision 41526)
@@ -2420,6 +2420,7 @@ gc_sweep(rb_objspace_t *objspace, int im https://github.com/ruby/ruby/blob/trunk/gc.c#L2420
 {
     if (immediate_sweep) {
 	struct heaps_slot *next;
+	gc_prof_sweep_timer_start(objspace);
 	before_gc_sweep(objspace);
 
 	while (objspace->heap.sweep_slots) {
@@ -2429,6 +2430,7 @@ gc_sweep(rb_objspace_t *objspace, int im https://github.com/ruby/ruby/blob/trunk/gc.c#L2430
 	}
 
 	after_gc_sweep(objspace);
+	gc_prof_sweep_timer_stop(objspace);
     }
     else {
 	before_gc_sweep(objspace);
@@ -3553,12 +3555,19 @@ gc_marks_test(rb_objspace_t *objspace, b https://github.com/ruby/ruby/blob/trunk/gc.c#L3555
 {
     bits_t *stored_bitmaps = gc_store_bitmaps(objspace);
     size_t i;
+    size_t stored_oldgen, stored_shady;
 
     rgengc_report(1, objspace, "gc_marks_test: test-full-gc\n");
 
     /* run major (full) gc with temporary mark/rememberset */
-    gc_marks_body(objspace, FALSE);
+    stored_oldgen = objspace->rgengc.oldgen_object_count;
+    stored_shady = objspace->rgengc.remembered_shady_object_count;
+    {
+	gc_marks_body(objspace, FALSE);
+    }
     objspace->rgengc.during_minor_gc = TRUE;
+    objspace->rgengc.oldgen_object_count = stored_oldgen;
+    objspace->rgengc.remembered_shady_object_count = stored_shady;
 
     /* check */
     for (i=0; i<heaps_used; i++) {
@@ -5064,9 +5073,9 @@ gc_prof_sweep_timer_stop(rb_objspace_t * https://github.com/ruby/ruby/blob/trunk/gc.c#L5073
     if (RUBY_DTRACE_GC_SWEEP_END_ENABLED()) {
 	RUBY_DTRACE_GC_SWEEP_END();
     }
+
     if (objspace->profile.run) {
 	double sweep_time;
-
 	gc_profile_record *record = gc_prof_record(objspace);
 
 	if (record->gc_time > 0) {

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

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