[project @ 1999-03-25 13:13:51 by simonm]
[ghc-hetmet.git] / ghc / rts / RtsFlags.c
index 2d378b5..8f494cd 100644 (file)
@@ -1,5 +1,8 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsFlags.c,v 1.4 1999/01/19 15:07:55 simonm Exp $
+ * $Id: RtsFlags.c,v 1.12 1999/03/25 13:14:07 simonm Exp $
+ *
+ * (c) The AQUA Project, Glasgow University, 1994-1997
+ * (c) The GHC Team, 1998-1999
  *
  * Functions for parsing the argument list.
  *
@@ -64,9 +67,11 @@ void initRtsFlagsDefaults(void)
     RtsFlags.GcFlags.minAllocAreaSize   = (256 * 1024)        / BLOCK_SIZE;
     RtsFlags.GcFlags.minOldGenSize      = (1024 * 1024)       / BLOCK_SIZE;
     RtsFlags.GcFlags.maxHeapSize       = (64  * 1024 * 1024) / BLOCK_SIZE;
+    RtsFlags.GcFlags.heapSizeSuggestion        = 0;    /* none */
     RtsFlags.GcFlags.pcFreeHeap                = 3;    /* 3% */
     RtsFlags.GcFlags.oldGenFactor       = 2;
     RtsFlags.GcFlags.generations        = 2;
+    RtsFlags.GcFlags.steps              = 2;
 
     RtsFlags.GcFlags.forceGC           = rtsFalse;
     RtsFlags.GcFlags.forcingInterval   = 5000000; /* 5MB (or words?) */
@@ -190,8 +195,6 @@ void initRtsFlagsDefaults(void)
 #ifdef TICKY_TICKY
     RtsFlags.TickyFlags.showTickyStats = rtsFalse;
     RtsFlags.TickyFlags.tickyFile      = NULL;
-
-    AllFlags.doUpdEntryCounts          = rtsTrue; /*ToDo:move? */
 #endif
 }
 
@@ -213,9 +216,11 @@ usage_text[] = {
 "  -k<size> Sets the initial thread stack size (default 1k)  Egs: -K4k   -K2m",
 "",
 "  -A<size> Sets the minimum allocation area size (default 256k) Egs: -A1m -A10k",
-"  -M<size> Sets the maximum heap size (default 64M)  Egs: -H256k -H1G",
+"  -M<size> Sets the maximum heap size (default 64M)  Egs: -M256k -M1G",
+"  -H<size> Sets the minimum heap size (default 0M)   Egs: -H24m  -H1G",
 "  -m<n>%   Minimum % of heap which must be available (default 3%)",
 "  -G<n>    Number of generations (default: 2)",
+"  -T<n>    Number of steps in younger generations (default: 2)",
 "  -s<file> Summary GC statistics   (default file: <program>.stat)",
 "  -S<file> Detailed GC statistics  (with -Sstderr going to stderr)",
 "",
@@ -267,8 +272,6 @@ usage_text[] = {
 "  -r<file>  Produce reduction profiling statistics (with -rstderr for stderr)",
 "",
 #endif
-"  -T<level> Trace garbage collection execution (debugging)",
-"",
 # ifdef PAR
 "  -N<n>     Use <n> PVMish processors in parallel (default: 2)",
 /* NB: the -N<n> is implemented by the driver!! */
@@ -441,7 +444,19 @@ error = rtsTrue;
 #ifdef DEBUG
              case 'D':
                /* hack warning: interpret the flags as a binary number */
-               *(int*)(&RtsFlags.DebugFlags) = decode(rts_argv[arg]+2);
+               { 
+                   I_ n = decode(rts_argv[arg]+2);
+                   if (n     &1) RtsFlags.DebugFlags.scheduler   = rtsTrue;
+                   if ((n>>1)&1) RtsFlags.DebugFlags.evaluator   = rtsTrue;
+                   if ((n>>2)&1) RtsFlags.DebugFlags.codegen     = rtsTrue;
+                   if ((n>>3)&1) RtsFlags.DebugFlags.weak        = rtsTrue;
+                   if ((n>>4)&1) RtsFlags.DebugFlags.gccafs      = rtsTrue;
+                   if ((n>>5)&1) RtsFlags.DebugFlags.gc          = rtsTrue;
+                   if ((n>>6)&1) RtsFlags.DebugFlags.block_alloc = rtsTrue;
+                   if ((n>>7)&1) RtsFlags.DebugFlags.sanity      = rtsTrue;
+                   if ((n>>8)&1) RtsFlags.DebugFlags.stable      = rtsTrue;
+                   if ((n>>9)&1) RtsFlags.DebugFlags.prof        = rtsTrue;
+                }
                break;
 #endif
 
@@ -481,13 +496,25 @@ error = rtsTrue;
 
              case 'G':
                RtsFlags.GcFlags.generations = decode(rts_argv[arg]+2);
-               if (RtsFlags.GcFlags.generations <= 1) {
+               if (RtsFlags.GcFlags.generations < 1) {
+                 bad_option(rts_argv[arg]);
+               }
+               break;
+
+             case 'T':
+               RtsFlags.GcFlags.steps = decode(rts_argv[arg]+2);
+               if (RtsFlags.GcFlags.steps < 1) {
                  bad_option(rts_argv[arg]);
                }
                break;
 
              case 'H':
-               /* ignore for compatibility with older versions */
+               RtsFlags.GcFlags.heapSizeSuggestion = 
+                 decode(rts_argv[arg]+2) / BLOCK_SIZE;
+
+               if (RtsFlags.GcFlags.heapSizeSuggestion <= 0) {
+                 bad_option(rts_argv[arg]);
+               }
                break;
 
              case 'j': /* force GC option */