[MLton-commit] r6552

Matthew Fluet fluet at mlton.org
Mon Apr 7 11:55:15 PDT 2008


Add thread-grow-ratio runtime option.

----------------------------------------------------------------------

U   mlton/trunk/runtime/gc/controls.h
U   mlton/trunk/runtime/gc/init.c
U   mlton/trunk/runtime/gc/stack.c

----------------------------------------------------------------------

Modified: mlton/trunk/runtime/gc/controls.h
===================================================================
--- mlton/trunk/runtime/gc/controls.h	2008-04-07 18:33:56 UTC (rev 6551)
+++ mlton/trunk/runtime/gc/controls.h	2008-04-07 18:55:14 UTC (rev 6552)
@@ -31,7 +31,8 @@
    */
   float nursery; 
   float ramSlop;
-  float threadShrink; 
+  float threadGrow;
+  float threadShrink;
 };
 
 struct GC_controls {

Modified: mlton/trunk/runtime/gc/init.c
===================================================================
--- mlton/trunk/runtime/gc/init.c	2008-04-07 18:33:56 UTC (rev 6551)
+++ mlton/trunk/runtime/gc/init.c	2008-04-07 18:55:14 UTC (rev 6552)
@@ -191,6 +191,13 @@
         } else if (0 == strcmp (arg, "stop")) {
           i++;
           s->controls.mayProcessAtMLton = FALSE;
+        } else if (0 == strcmp (arg, "thread-grow-ratio")) {
+          i++;
+          if (i == argc)
+            die ("@MLton thread-grow-ratio missing argument.");
+          s->controls.ratios.threadGrow = stringToFloat (argv[i++]);
+          unless (1.0 < s->controls.ratios.threadGrow)
+            die ("@MLton thread-grow-ratio argument must greater than 1.0.");
         } else if (0 == strcmp (arg, "thread-shrink-ratio")) {
           i++;
           if (i == argc)
@@ -245,6 +252,7 @@
   s->controls.ratios.markCompactGenerational = 8.0;
   s->controls.ratios.nursery = 10.0;
   s->controls.ratios.ramSlop = 0.5;
+  s->controls.ratios.threadGrow = 2.0;
   s->controls.ratios.threadShrink = 0.5;
   s->controls.summary = FALSE;
   s->cumulativeStatistics.bytesAllocated = 0;

Modified: mlton/trunk/runtime/gc/stack.c
===================================================================
--- mlton/trunk/runtime/gc/stack.c	2008-04-07 18:33:56 UTC (rev 6551)
+++ mlton/trunk/runtime/gc/stack.c	2008-04-07 18:55:14 UTC (rev 6552)
@@ -154,7 +154,8 @@
 size_t sizeofStackGrow (GC_state s, GC_stack stack) {
   size_t res;
 
-  res = max (2 * stack->reserved, sizeofStackMinimumReserved (s, stack));
+  res = max ((size_t)(s->controls.ratios.threadGrow * stack->reserved),
+             sizeofStackMinimumReserved (s, stack));
   return res;
 }
 




More information about the MLton-commit mailing list