[project @ 2002-12-04 11:10:17 by simonmar]
[ghc-hetmet.git] / ghc / rts / Storage.c
index 5a015d9..5af42f4 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.68 2002/08/16 13:20:36 simonmar Exp $
+ * $Id: Storage.c,v 1.70 2002/11/01 11:05:47 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -533,7 +533,25 @@ allocate( nat n )
 lnat
 allocated_bytes( void )
 {
-  return (alloc_blocks * BLOCK_SIZE_W - (alloc_HpLim - alloc_Hp));
+    lnat allocated;
+
+    allocated = alloc_blocks * BLOCK_SIZE_W - (alloc_HpLim - alloc_Hp);
+    if (pinned_object_block != NULL) {
+       allocated -= (pinned_object_block->start + BLOCK_SIZE_W) - 
+           pinned_object_block->free;
+    }
+       
+    return allocated;
+}
+
+void
+tidyAllocateLists (void)
+{
+    if (small_alloc_list != NULL) {
+       ASSERT(alloc_Hp >= small_alloc_list->start && 
+              alloc_Hp <= small_alloc_list->start + BLOCK_SIZE);
+       small_alloc_list->free = alloc_Hp;
+    }
 }
 
 /* ---------------------------------------------------------------------------