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

ruby-changes:29348

From: ko1 <ko1@a...>
Date: Wed, 19 Jun 2013 06:35:54 +0900 (JST)
Subject: [ruby-changes:29348] ko1:r41400 (trunk): * gc.c (gc_stress_set): add special option of GC.stress.

ko1	2013-06-19 06:35:40 +0900 (Wed, 19 Jun 2013)

  New Revision: 41400

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

  Log:
    * gc.c (gc_stress_set): add special option of GC.stress.
      `GC.stress=(flag)' accepts integer to control behavior of GC.
      See code for details. Of course, this feature is only for MRI.
      You can debug RGenGC (WB) using `GC.stress = 1'.
      Using this option, do minor marking at all possible places.
      GC::STRESS_MINOR_MARK = 1 and GC::STRESS_LAZY_SWEEP = 2
      seem good to add.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41399)
+++ ChangeLog	(revision 41400)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jun 19 06:31:08 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (gc_stress_set): add special option of GC.stress.
+	  `GC.stress=(flag)' accepts integer to control behavior of GC.
+	  See code for details. Of course, this feature is only for MRI.
+
+	  You can debug RGenGC (WB) using `GC.stress = 1'.
+	  Using this option, do minor marking at all possible places.
+
+	  GC::STRESS_MINOR_MARK = 1 and GC::STRESS_LAZY_SWEEP = 2
+	  seem good to add.
+
 Wed Jun 19 06:29:31 2013  Koichi Sasada  <ko1@a...>
 
 	* vm.c (kwmerge_i): add WB.
Index: gc.c
===================================================================
--- gc.c	(revision 41399)
+++ gc.c	(revision 41400)
@@ -3833,6 +3833,13 @@ garbage_collect_body(rb_objspace_t *objs https://github.com/ruby/ruby/blob/trunk/gc.c#L3833
     if (ruby_gc_stress && !ruby_disable_gc_stress) {
 	minor_gc = FALSE;
 	immediate_sweep = TRUE;
+
+	if (FIXNUM_P(ruby_gc_stress)) {
+	    int flag = ruby_gc_stress;
+
+	    if (flag & 0x01) minor_gc = TRUE;
+	    if (flag & 0x02) immediate_sweep = FALSE;
+	}
     }
     else {
 	if (full_mark) {
@@ -4171,7 +4178,7 @@ gc_stress_set(VALUE self, VALUE flag) https://github.com/ruby/ruby/blob/trunk/gc.c#L4178
 {
     rb_objspace_t *objspace = &rb_objspace;
     rb_secure(2);
-    ruby_gc_stress = RTEST(flag);
+    ruby_gc_stress = FIXNUM_P(flag) ? flag : (RTEST(flag) ? Qtrue : Qfalse);
     return flag;
 }
 

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

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