[project @ 2001-08-14 13:40:07 by sewardj]
[ghc-hetmet.git] / ghc / rts / Storage.c
index 0c5a815..a2c111b 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.44 2001/08/08 10:50:37 simonmar Exp $
+ * $Id: Storage.c,v 1.49 2001/08/14 13:40:09 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -7,6 +7,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsUtils.h"
 #include "RtsFlags.h"
@@ -59,7 +60,7 @@ static void *stgReallocForGMP (void *ptr, size_t old_size, size_t new_size);
 static void  stgDeallocForGMP (void *ptr, size_t size);
 
 void
-initStorage (void)
+initStorage( void )
 {
   nat g, s;
   step *stp;
@@ -82,7 +83,8 @@ initStorage (void)
   }
 #endif
 
-  if (RtsFlags.GcFlags.heapSizeSuggestion > 
+  if (RtsFlags.GcFlags.maxHeapSize != 0 &&
+      RtsFlags.GcFlags.heapSizeSuggestion > 
       RtsFlags.GcFlags.maxHeapSize) {
     RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
   }
@@ -147,9 +149,12 @@ initStorage (void)
       stp->scan = NULL;
       stp->scan_bd = NULL;
       stp->large_objects = NULL;
+      stp->n_large_blocks = 0;
       stp->new_large_objects = NULL;
       stp->scavenged_large_objects = NULL;
+      stp->n_scavenged_large_blocks = 0;
       stp->is_compacted = 0;
+      stp->bitmap = NULL;
     }
   }
   
@@ -161,7 +166,10 @@ initStorage (void)
     generations[g].steps[s].to = &generations[g+1].steps[0];
   }
   
-  /* The oldest generation has one step. */
+  /* The oldest generation has one step and it is compacted. */
+  if (RtsFlags.GcFlags.compact) {
+      oldest_gen->steps[0].is_compacted = 1;
+  }
   oldest_gen->steps[0].to = &oldest_gen->steps[0];
 
   /* generation 0 is special: that's the nursery */