[project @ 2001-10-01 11:09:02 by simonmar]
[ghc-hetmet.git] / ghc / rts / Storage.c
index feff59c..134106d 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.48 2001/08/09 12:46:06 sewardj Exp $
+ * $Id: Storage.c,v 1.51 2001/10/01 11:09:02 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsUtils.h"
 #include "RtsFlags.h"
@@ -88,6 +89,13 @@ initStorage( void )
     RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
   }
 
+  if (RtsFlags.GcFlags.maxHeapSize != 0 &&
+      RtsFlags.GcFlags.minAllocAreaSize > 
+      RtsFlags.GcFlags.maxHeapSize) {
+      prog_belch("maximum heap size (-M) is smaller than minimum alloc area size (-A)");
+      exit(1);
+  }
+
   initBlockAllocator();
   
   /* allocate generation info array */
@@ -167,7 +175,11 @@ initStorage( void )
   
   /* The oldest generation has one step and it is compacted. */
   if (RtsFlags.GcFlags.compact) {
-      oldest_gen->steps[0].is_compacted = 1;
+      if (RtsFlags.GcFlags.generations == 1) {
+         belch("WARNING: compaction is incompatible with -G1; disabled");
+      } else {
+         oldest_gen->steps[0].is_compacted = 1;
+      }
   }
   oldest_gen->steps[0].to = &oldest_gen->steps[0];