[project @ 2000-08-07 16:06:38 by rrt]
[ghc-hetmet.git] / ghc / rts / Storage.h
index a1e43dc..a9c6a09 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.h,v 1.10 1999/11/02 15:06:05 simonmar Exp $
+ * $Id: Storage.h,v 1.16 2000/04/14 15:18:07 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -78,7 +78,7 @@ extern void PleaseStopAllocating(void);
    MarkRoot(StgClosure *p)     Returns the new location of the root.
    -------------------------------------------------------------------------- */
 
-extern void   GarbageCollect(void (*get_roots)(void));
+extern void   GarbageCollect(void (*get_roots)(void),rtsBool force_major_gc);
 extern StgClosure *MarkRoot(StgClosure *p);
 
 /* -----------------------------------------------------------------------------
@@ -128,27 +128,29 @@ recordOldToNewPtrs(StgMutClosure *p)
   }
 }
 
-#define updateWithIndirection(p1, p2)                          \
-  {                                                            \
-    bdescr *bd;                                                        \
-                                                               \
-    bd = Bdescr((P_)p1);                                       \
-    if (bd->gen->no == 0) {                                    \
-      ((StgInd *)p1)->indirectee = p2;                         \
-      SET_INFO(p1,&IND_info);                                  \
-      TICK_UPD_NEW_IND();                                      \
-    } else {                                                   \
-      ((StgIndOldGen *)p1)->indirectee = p2;                   \
-      ((StgIndOldGen *)p1)->mut_link = bd->gen->mut_once_list; \
-      bd->gen->mut_once_list = (StgMutClosure *)p1;            \
-      SET_INFO(p1,&IND_OLDGEN_info);                           \
-      TICK_UPD_OLD_IND();                                      \
-    }                                                          \
+#define updateWithIndirection(info, p1, p2)                            \
+  {                                                                    \
+    bdescr *bd;                                                                \
+                                                                       \
+    bd = Bdescr((P_)p1);                                               \
+    if (bd->gen->no == 0) {                                            \
+      ((StgInd *)p1)->indirectee = p2;                                 \
+      SET_INFO(p1,&IND_info);                                          \
+      TICK_UPD_NEW_IND();                                              \
+    } else {                                                           \
+      ((StgIndOldGen *)p1)->indirectee = p2;                           \
+      if (info != &BLACKHOLE_BQ_info) {                                        \
+        ((StgIndOldGen *)p1)->mut_link = bd->gen->mut_once_list;       \
+        bd->gen->mut_once_list = (StgMutClosure *)p1;                  \
+      }                                                                        \
+      SET_INFO(p1,&IND_OLDGEN_info);                                   \
+      TICK_UPD_OLD_IND();                                              \
+    }                                                                  \
   }
 
 #if defined(TICKY_TICKY) || defined(PROFILING)
 static inline void
-updateWithPermIndirection(StgClosure *p1, StgClosure *p2) 
+updateWithPermIndirection(const StgInfoTable *info, StgClosure *p1, StgClosure *p2) 
 {
   bdescr *bd;
 
@@ -159,8 +161,10 @@ updateWithPermIndirection(StgClosure *p1, StgClosure *p2)
     TICK_UPD_NEW_PERM_IND(p1);
   } else {
     ((StgIndOldGen *)p1)->indirectee = p2;
-    ((StgIndOldGen *)p1)->mut_link = bd->gen->mut_once_list;
-    bd->gen->mut_once_list = (StgMutClosure *)p1;
+    if (info != &BLACKHOLE_BQ_info) {
+      ((StgIndOldGen *)p1)->mut_link = bd->gen->mut_once_list;
+      bd->gen->mut_once_list = (StgMutClosure *)p1;
+    }
     SET_INFO(p1,&IND_OLDGEN_PERM_info);
     TICK_UPD_OLD_PERM_IND();
   }
@@ -168,11 +172,29 @@ updateWithPermIndirection(StgClosure *p1, StgClosure *p2)
 #endif
 
 /* -----------------------------------------------------------------------------
-   The CAF list - used to let us revert CAFs
+   The CAF table - used to let us revert CAFs
 
    -------------------------------------------------------------------------- */
 
-extern StgCAF* enteredCAFs;
+#if defined(INTERPRETER)
+typedef struct StgCAFTabEntry_ {
+    StgClosure*   closure;
+    StgInfoTable* origItbl;
+} StgCAFTabEntry;
+
+extern void addToECafTable ( StgClosure* closure, StgInfoTable* origItbl );
+extern void clearECafTable ( void );
+
+extern StgCAF*         ecafList;
+extern StgCAFTabEntry* ecafTable;
+extern StgInt          usedECafTable;
+extern StgInt          sizeECafTable;
+#endif
+
+#if defined(DEBUG)
+void printMutOnceList(generation *gen);
+void printMutableList(generation *gen);
+#endif DEBUG
 
 #endif STORAGE_H