[project @ 2003-03-21 16:18:37 by sof]
authorsof <unknown>
Fri, 21 Mar 2003 16:18:39 +0000 (16:18 +0000)
committersof <unknown>
Fri, 21 Mar 2003 16:18:39 +0000 (16:18 +0000)
Friday morning code-wibbling:
- made RetainerProfile.c:firstStack a 'static'
- added RetainerProfile.c:retainerStackBlocks()

ghc/rts/RetainerProfile.c
ghc/rts/RetainerProfile.h
ghc/rts/Storage.c
ghc/rts/Storage.h

index 916ce90..9ab12f1 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RetainerProfile.c,v 1.7 2003/02/22 04:51:52 sof Exp $
+ * $Id: RetainerProfile.c,v 1.8 2003/03/21 16:18:37 sof Exp $
  *
  * (c) The GHC Team, 2001
  * Author: Sungwoo Park
@@ -158,7 +158,7 @@ typedef struct {
     the topmost element on the previous block group so as to satisfy
     the invariants described above.
  */
-bdescr *firstStack = NULL;
+static bdescr *firstStack = NULL;
 static bdescr *currentStack;
 static stackElement *stackBottom, *stackTop, *stackLimit;
 
@@ -258,6 +258,21 @@ isEmptyRetainerStack( void )
 }
 
 /* -----------------------------------------------------------------------------
+ * Returns size of stack
+ * -------------------------------------------------------------------------- */
+lnat
+retainerStackBlocks()
+{
+    bdescr* bd;
+    lnat res = 0;
+
+    for (bd = firstStack; bd != NULL; bd = bd->link) 
+      res += bd->blocks;
+
+    return res;
+}
+
+/* -----------------------------------------------------------------------------
  * Returns rtsTrue if stackTop is at the stack boundary of the current stack,
  * i.e., if the current stack chunk is empty.
  * -------------------------------------------------------------------------- */
index 51ddc64..09dcb1c 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RetainerProfile.h,v 1.2 2001/11/26 16:54:21 simonmar Exp $
+ * $Id: RetainerProfile.h,v 1.3 2003/03/21 16:18:38 sof Exp $
  *
  * (c) The GHC Team, 2001
  * Author: Sungwoo Park
@@ -38,9 +38,9 @@ retainerSetOf( StgClosure *c )
     return (RetainerSet *)((StgWord)RSET(c) ^ flip);
 }
 
-// firstStack is exported because memInventory() in Schedule.c uses it.
+// Used by Storage.c:memInventory()
 #ifdef DEBUG
-extern bdescr *firstStack;
+extern lnat retainerStackBlocks ( void );
 #endif
 
 #endif /* PROFILING */
index f92e653..4e7cdb6 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.76 2003/02/01 09:10:17 mthomas Exp $
+ * $Id: Storage.c,v 1.77 2003/03/21 16:18:38 sof Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -832,8 +832,7 @@ memInventory(void)
 
 #ifdef PROFILING
   if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER) {
-    for (bd = firstStack; bd != NULL; bd = bd->link) 
-      total_blocks += bd->blocks;
+      total_blocks += retainerStackBlocks();
   }
 #endif
 
index 70e7c2a..838248d 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.h,v 1.47 2002/12/13 14:43:06 simonmar Exp $
+ * $Id: Storage.h,v 1.48 2003/03/21 16:18:39 sof Exp $
  *
  * (c) The GHC Team, 1998-2002
  *
@@ -53,7 +53,7 @@ extern void exitStorage(void);
 
    lnat  allocated_bytes(void)  Returns the number of bytes allocated
                                 via allocate() since the last GC.
-                               Used in the reoprting of statistics.
+                               Used in the reporting of statistics.
 
    SMP: allocate and doYouWantToGC can be used from STG code, they are
    surrounded by a mutex.