[project @ 1999-08-25 16:11:43 by simonmar]
[ghc-hetmet.git] / ghc / rts / RtsFlags.c
index 19c522e..1615934 100644 (file)
@@ -1,5 +1,8 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsFlags.c,v 1.3 1999/01/13 17:25:42 simonm Exp $
+ * $Id: RtsFlags.c,v 1.15 1999/08/25 16:11:50 simonmar Exp $
+ *
+ * (c) The AQUA Project, Glasgow University, 1994-1997
+ * (c) The GHC Team, 1998-1999
  *
  * Functions for parsing the argument list.
  *
@@ -62,9 +65,13 @@ 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.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?) */
@@ -90,23 +97,7 @@ void initRtsFlagsDefaults(void)
     RtsFlags.ProfFlags.doHeapProfile = rtsFalse;
 #endif
 
-/* there really shouldn't be a threads limit for concurrent mandatory threads.
-   For now, unlimitied means less than 64k (there's a storage overhead) -- SOF
-*/
-#if defined(CONCURRENT) && !defined(GRAN)
-    RtsFlags.ConcFlags.ctxtSwitchTime  = CS_MIN_MILLISECS;  /* In milliseconds */
-    RtsFlags.ConcFlags.maxThreads      = 65536;
-    RtsFlags.ConcFlags.stkChunkSize    = 1024;
-    RtsFlags.ConcFlags.maxLocalSparks  = 65536;
-#endif /* CONCURRENT only */
-
-#if GRAN
     RtsFlags.ConcFlags.ctxtSwitchTime  = CS_MIN_MILLISECS;  /* In milliseconds */
-    RtsFlags.ConcFlags.maxThreads      = 32;
-    RtsFlags.ConcFlags.stkChunkSize    = 1024;
-    RtsFlags.ConcFlags.maxLocalSparks  = 500;
-#endif /* GRAN */
-
 #ifdef PAR
     RtsFlags.ParFlags.parallelStats    = rtsFalse;
     RtsFlags.ParFlags.granSimStats     = rtsFalse;
@@ -186,10 +177,8 @@ void initRtsFlagsDefaults(void)
 #endif
 
 #ifdef TICKY_TICKY
-    RtsFlags.TickyFlags.showTickyStats = rtsFalse;
-    RtsFlags.TickyFlags.tickyFile      = NULL;
-
-    AllFlags.doUpdEntryCounts          = rtsTrue; /*ToDo:move? */
+    RtsFlags.TickyFlags.showTickyStats  = rtsFalse;
+    RtsFlags.TickyFlags.tickyFile       = NULL;
 #endif
 }
 
@@ -211,9 +200,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)",
 "",
@@ -265,8 +256,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!! */
@@ -274,16 +263,11 @@ usage_text[] = {
 "  -C<secs>  Context-switch interval in seconds",
 "                (0 or no argument means switch as often as possible)",
 "                the default is .01 sec; resolution is .01 sec",
-"  -e<size>        Size of spark pools (default 100)",
 # ifdef PAR
 "  -q        Enable activity profile (output files in ~/<program>*.gr)",
 "  -qb       Enable binary activity profile (output file /tmp/<program>.gb)",
 "  -Q<size>  Set pack-buffer size (default: 1024)",
-# else
-"  -q[v]     Enable quasi-parallel profile (output file <program>.qp)",
 # endif
-"  -t<num>   Set maximum number of advisory threads per PE (default 32)",
-"  -o<num>   Set stack chunk size (default 1024)",
 # ifdef PAR
 "  -d        Turn on PVM-ish debugging",
 "  -O        Disable output for performance measurement",
@@ -429,10 +413,29 @@ 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 */
-               *(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
 
@@ -472,13 +475,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 */
@@ -489,9 +504,11 @@ error = rtsTrue;
                }
                break;
 
-             case 'S': /* NB: no difference at present ! */
+             case 'S':
+               RtsFlags.GcFlags.giveStats ++;
+
              case 's':
-               RtsFlags.GcFlags.giveStats ++; /* will be VERBOSE_GC_STATS */
+               RtsFlags.GcFlags.giveStats ++;
 #ifdef PAR
                /* Opening all those files would almost certainly fail... */
                RtsFlags.ParFlags.parallelStats = rtsTrue;
@@ -697,16 +714,6 @@ error = rtsTrue;
                }
                break;
 
-             case 't':
-               if (rts_argv[arg][2] != '\0') {
-                   RtsFlags.ConcFlags.maxThreads
-                     = strtol(rts_argv[arg]+2, (char **) NULL, 10);
-               } else {
-                   fprintf(stderr, "setupRtsFlags: missing size for -t\n");
-                   error = rtsTrue;
-               }
-               break;
-
              /* =========== PARALLEL =========================== */
              case 'e':
                PAR_BUILD_ONLY(