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

ruby-changes:31754

From: ko1 <ko1@a...>
Date: Mon, 25 Nov 2013 03:13:56 +0900 (JST)
Subject: [ruby-changes:31754] ko1:r43833 (trunk): * gc.c: change terminology OLDSPACE -> OLDMALLOC.

ko1	2013-11-25 03:13:48 +0900 (Mon, 25 Nov 2013)

  New Revision: 43833

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

  Log:
    * gc.c: change terminology OLDSPACE -> OLDMALLOC.
      (oldspace -> oldmalloc for variable names)
      OLDSPACE is confusing because it is not includes slots.
      To more clearly, rename such as (oldspace_limit -> oldmalloc_limit).
      It is clear that it measures (estimates) malloc()'ed size.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43832)
+++ ChangeLog	(revision 43833)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Nov 25 03:10:46 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c: change terminology OLDSPACE -> OLDMALLOC.
+	  (oldspace -> oldmalloc for variable names)
+
+	  OLDSPACE is confusing because it is not includes slots.
+	  To more clearly, rename such as (oldspace_limit -> oldmalloc_limit).
+	  It is clear that it measures (estimates) malloc()'ed size.
+
 Mon Nov 25 00:50:03 2013  Masaki Matsushita  <glass.saga@g...>
 
 	* internal.h: use __builtin_bswap16() if possible.
Index: gc.c
===================================================================
--- gc.c	(revision 43832)
+++ gc.c	(revision 43833)
@@ -112,14 +112,14 @@ rb_gc_guarded_ptr(volatile VALUE *ptr) https://github.com/ruby/ruby/blob/trunk/gc.c#L112
 #define GC_MALLOC_LIMIT_GROWTH_FACTOR 1.4
 #endif
 
-#ifndef GC_OLDSPACE_LIMIT_MIN
-#define GC_OLDSPACE_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)
+#ifndef GC_OLDMALLOC_LIMIT_MIN
+#define GC_OLDMALLOC_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)
 #endif
-#ifndef GC_OLDSPACE_LIMIT_GROWTH_FACTOR
-#define GC_OLDSPACE_LIMIT_GROWTH_FACTOR 1.2
+#ifndef GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
+#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR 1.2
 #endif
-#ifndef GC_OLDSPACE_LIMIT_MAX
-#define GC_OLDSPACE_LIMIT_MAX (128 * 1024 * 1024 /* 128MB */)
+#ifndef GC_OLDMALLOC_LIMIT_MAX
+#define GC_OLDMALLOC_LIMIT_MAX (128 * 1024 * 1024 /* 128MB */)
 #endif
 
 typedef struct {
@@ -130,9 +130,9 @@ typedef struct { https://github.com/ruby/ruby/blob/trunk/gc.c#L130
     unsigned int malloc_limit_min;
     unsigned int malloc_limit_max;
     double malloc_limit_growth_factor;
-    unsigned int oldspace_limit_min;
-    unsigned int oldspace_limit_max;
-    double oldspace_limit_growth_factor;
+    unsigned int oldmalloc_limit_min;
+    unsigned int oldmalloc_limit_max;
+    double oldmalloc_limit_growth_factor;
 #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
     VALUE gc_stress;
 #endif
@@ -146,9 +146,9 @@ static ruby_gc_params_t gc_params = { https://github.com/ruby/ruby/blob/trunk/gc.c#L146
     GC_MALLOC_LIMIT_MIN,
     GC_MALLOC_LIMIT_MAX,
     GC_MALLOC_LIMIT_GROWTH_FACTOR,
-    GC_OLDSPACE_LIMIT_MIN,
-    GC_OLDSPACE_LIMIT_MAX,
-    GC_OLDSPACE_LIMIT_GROWTH_FACTOR,
+    GC_OLDMALLOC_LIMIT_MIN,
+    GC_OLDMALLOC_LIMIT_MAX,
+    GC_OLDMALLOC_LIMIT_GROWTH_FACTOR,
 #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
     FALSE,
 #endif
@@ -851,7 +851,7 @@ rb_objspace_alloc(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L851
 
     malloc_limit = gc_params.malloc_limit_min;
 #if RGENGC_ESTIMATE_OLDSPACE
-    objspace->rgengc.oldspace_increase_limit = gc_params.oldspace_limit_min;
+    objspace->rgengc.oldspace_increase_limit = gc_params.oldmalloc_limit_min;
 #endif
 
     return objspace;
@@ -2854,23 +2854,23 @@ gc_before_sweep(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L2854
 	if (objspace->rgengc.oldspace_increase > objspace->rgengc.oldspace_increase_limit) {
 	    objspace->rgengc.need_major_gc = TRUE;
 	    objspace->rgengc.oldspace_increase_limit =
-	      (size_t)(objspace->rgengc.oldspace_increase_limit * gc_params.oldspace_limit_growth_factor);
-	    if (objspace->rgengc.oldspace_increase_limit > gc_params.oldspace_limit_max) {
-		objspace->rgengc.oldspace_increase_limit = gc_params.oldspace_limit_max;
+	      (size_t)(objspace->rgengc.oldspace_increase_limit * gc_params.oldmalloc_limit_growth_factor);
+	    if (objspace->rgengc.oldspace_increase_limit > gc_params.oldmalloc_limit_max) {
+		objspace->rgengc.oldspace_increase_limit = gc_params.oldmalloc_limit_max;
 	    }
 	}
 	else {
 	    objspace->rgengc.oldspace_increase_limit =
-	      (size_t)(objspace->rgengc.oldspace_increase_limit / ((gc_params.oldspace_limit_growth_factor - 1)/10 + 1));
-	    if (objspace->rgengc.oldspace_increase_limit < gc_params.oldspace_limit_min) {
-		objspace->rgengc.oldspace_increase_limit = gc_params.oldspace_limit_min;
+	      (size_t)(objspace->rgengc.oldspace_increase_limit / ((gc_params.oldmalloc_limit_growth_factor - 1)/10 + 1));
+	    if (objspace->rgengc.oldspace_increase_limit < gc_params.oldmalloc_limit_min) {
+		objspace->rgengc.oldspace_increase_limit = gc_params.oldmalloc_limit_min;
 	    }
 	}
 
 	if (0) fprintf(stderr, "%d\t%d\t%u\t%u\t%d\n", (int)rb_gc_count(), objspace->rgengc.need_major_gc,
 		       (unsigned int)objspace->rgengc.oldspace_increase,
 		       (unsigned int)objspace->rgengc.oldspace_increase_limit,
-		       (unsigned int)gc_params.oldspace_limit_max);
+		       (unsigned int)gc_params.oldmalloc_limit_max);
     }
     else {
 	/* major GC */
@@ -5298,9 +5298,9 @@ gc_set_initial_pages(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L5298
  * * RUBY_GC_MALLOC_LIMIT_MAX (new from 2.1)
  * * RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR (new from 2.1)
  *
- * * RUBY_GC_OLDSPACE_LIMIT (new from 2.1)
- * * RUBY_GC_OLDSPACE_LIMIT_MAX (new from 2.1)
- * * RUBY_GC_OLDSPACE_LIMIT_GROWTH_FACTOR (new from 2.1)
+ * * RUBY_GC_OLDMALLOC_LIMIT (new from 2.1)
+ * * RUBY_GC_OLDMALLOC_LIMIT_MAX (new from 2.1)
+ * * RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR (new from 2.1)
  */
 
 void
@@ -5330,9 +5330,11 @@ ruby_gc_set_params(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L5330
     get_envparam_int("RUBY_GC_MALLOC_LIMIT_MAX", &gc_params.malloc_limit_max, 0);
     get_envparam_double("RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR", &gc_params.malloc_limit_growth_factor, 1.0);
 
-    get_envparam_int("RUBY_GC_OLDSPACE_LIMIT", &gc_params.oldspace_limit_min, 0);
-    get_envparam_int("RUBY_GC_OLDSPACE_LIMIT_MAX", &gc_params.oldspace_limit_max, 0);
-    get_envparam_double("RUBY_GC_OLDSPACE_LIMIT_GROWTH_FACTOR", &gc_params.oldspace_limit_growth_factor, 1.0);
+#ifdef RGENGC_ESTIMATE_OLDSPACE
+    get_envparam_int("RUBY_GC_OLDMALLOC_LIMIT", &gc_params.oldmalloc_limit_min, 0);
+    get_envparam_int("RUBY_GC_OLDMALLOC_LIMIT_MAX", &gc_params.oldmalloc_limit_max, 0);
+    get_envparam_double("RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR", &gc_params.oldmalloc_limit_growth_factor, 1.0);
+#endif
 }
 
 RUBY_ALIAS_FUNCTION_VOID(rb_gc_set_params(void), ruby_gc_set_params, ())

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

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