[project @ 1999-01-19 15:07:53 by simonm]
authorsimonm <unknown>
Tue, 19 Jan 1999 15:07:56 +0000 (15:07 +0000)
committersimonm <unknown>
Tue, 19 Jan 1999 15:07:56 +0000 (15:07 +0000)
- Add -F<factor> flag which governs the threshold size of the oldest
  generation.

- Add RtsFlags.GcFlags.minOldGenSize (no flag yet) so that we don't
  have to guess the initial size of the oldest generation.

ghc/rts/GC.c
ghc/rts/RtsFlags.c
ghc/rts/RtsFlags.h
ghc/rts/Storage.c

index d057c19..1b3dc0d 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.12 1999/01/18 16:05:15 simonm Exp $
+ * $Id: GC.c,v 1.13 1999/01/19 15:07:53 simonm Exp $
  *
  * Two-space garbage collector
  *
@@ -386,8 +386,8 @@ void GarbageCollect(void (*get_roots)(void))
    */
   if (major_gc) {
     oldest_gen->max_blocks = 
-      stg_max(oldest_gen->steps[0].to_blocks * 2,
-             RtsFlags.GcFlags.minAllocAreaSize * 4);
+      stg_max(oldest_gen->steps[0].to_blocks * RtsFlags.GcFlags.oldGenFactor,
+             RtsFlags.GcFlags.minOldGenSize);
     if (oldest_gen->max_blocks > RtsFlags.GcFlags.maxHeapSize / 2) {
       oldest_gen->max_blocks = RtsFlags.GcFlags.maxHeapSize / 2;
       if (((int)oldest_gen->max_blocks - (int)oldest_gen->steps[0].to_blocks) < 
index 19c522e..2d378b5 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsFlags.c,v 1.3 1999/01/13 17:25:42 simonm Exp $
+ * $Id: RtsFlags.c,v 1.4 1999/01/19 15:07:55 simonm Exp $
  *
  * Functions for parsing the argument list.
  *
@@ -62,8 +62,10 @@ void initRtsFlagsDefaults(void)
     RtsFlags.GcFlags.initialStkSize    = 1024 / sizeof(W_);
 
     RtsFlags.GcFlags.minAllocAreaSize   = (256 * 1024)        / BLOCK_SIZE;
+    RtsFlags.GcFlags.minOldGenSize      = (1024 * 1024)       / BLOCK_SIZE;
     RtsFlags.GcFlags.maxHeapSize       = (64  * 1024 * 1024) / BLOCK_SIZE;
     RtsFlags.GcFlags.pcFreeHeap                = 3;    /* 3% */
+    RtsFlags.GcFlags.oldGenFactor       = 2;
     RtsFlags.GcFlags.generations        = 2;
 
     RtsFlags.GcFlags.forceGC           = rtsFalse;
@@ -429,6 +431,13 @@ error = rtsTrue;
                RtsFlags.GcFlags.ringBell = rtsTrue;
                break;
 
+             case 'F':
+               RtsFlags.GcFlags.oldGenFactor = atof(rts_argv[arg]+2);
+             
+               if (RtsFlags.GcFlags.oldGenFactor < 0)
+                 bad_option( rts_argv[arg] );
+               break;
+             
 #ifdef DEBUG
              case 'D':
                /* hack warning: interpret the flags as a binary number */
index 7d2982b..ce6ba6d 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsFlags.h,v 1.3 1999/01/13 17:25:43 simonm Exp $
+ * $Id: RtsFlags.h,v 1.4 1999/01/19 15:07:55 simonm Exp $
  *
  * Datatypes that holds the command-line flag settings.
  *
@@ -21,6 +21,8 @@ struct GC_FLAGS {
 
     nat            maxHeapSize;        /* in *blocks* */
     nat     minAllocAreaSize;   /* in *blocks* */
+    nat     minOldGenSize;      /* in *blocks* */
+    double  oldGenFactor;
     double  pcFreeHeap;
 
     nat     generations;
index 3d7a0b7..0403f44 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.3 1999/01/13 17:25:47 simonm Exp $
+ * $Id: Storage.c,v 1.4 1999/01/19 15:07:56 simonm Exp $
  *
  * Storage manager front end
  *
@@ -70,7 +70,7 @@ initStorage (void)
   generations[g].n_steps = 1;
   generations[g].steps = 
     stgMallocBytes(1 * sizeof(struct _step), "initStorage: last step");
-  generations[g].max_blocks = RtsFlags.GcFlags.minAllocAreaSize * 4;
+  generations[g].max_blocks = RtsFlags.GcFlags.minOldGenSize;
   step = &generations[g].steps[0];
   step->no = 0;
   step->gen = &generations[g];
@@ -86,7 +86,7 @@ initStorage (void)
     generations[g].n_steps = 2;
     generations[g].steps  = stgMallocBytes (2 * sizeof(struct _step),
                                            "initStorage: steps");
-    generations[g].max_blocks = RtsFlags.GcFlags.minAllocAreaSize * 4;
+    generations[g].max_blocks = RtsFlags.GcFlags.minOldGenSize;
   }
 
   for (g = 0; g < RtsFlags.GcFlags.generations-1; g++) {