[project @ 2003-12-18 12:24:59 by simonmar]
[ghc-hetmet.git] / ghc / rts / BlockAlloc.c
index 9d13719..63da2a2 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: BlockAlloc.c,v 1.14 2002/07/17 09:21:49 simonmar Exp $
+ * $Id: BlockAlloc.c,v 1.17 2003/11/12 17:49:05 sof Exp $
  *
  * (c) The GHC Team 1998-2000
  * 
@@ -29,7 +29,7 @@ static void    initMBlock(void *mblock);
 static bdescr *allocMegaGroup(nat mblocks);
 static void    freeMegaGroup(bdescr *bd);
 
-static bdescr *free_list;
+static bdescr *free_list = NULL;
 
 /* -----------------------------------------------------------------------------
    Initialisation
@@ -37,14 +37,14 @@ static bdescr *free_list;
 
 void initBlockAllocator(void)
 {
-  free_list = NULL;
+    // The free list starts off NULL
 }
 
 /* -----------------------------------------------------------------------------
    Allocation
    -------------------------------------------------------------------------- */
 
-static inline void
+STATIC_INLINE void
 initGroup(nat n, bdescr *head)
 {
   bdescr *bd;
@@ -194,7 +194,7 @@ allocMegaGroup(nat n)
  * pointer to the newly enlarged group p.
  */
 
-static inline bdescr *
+STATIC_INLINE bdescr *
 coalesce(bdescr *p)
 {
   bdescr *bd, *q;
@@ -265,7 +265,7 @@ freeMegaGroup(bdescr *p)
 
   n = p->blocks * BLOCK_SIZE / MBLOCK_SIZE + 1;
   for (; n > 0; (W_)p += MBLOCK_SIZE, n--) {
-    initMBlock((void *)((W_)p & ~MBLOCK_MASK));
+    initMBlock(MBLOCK_ROUND_DOWN(p));
     initGroup(BLOCKS_PER_MBLOCK, p);
     freeGroup(p);
   }