A small GC optimisation
[ghc-hetmet.git] / includes / rts / storage / GC.h
index e7b2e84..7cee670 100644 (file)
@@ -63,14 +63,15 @@ typedef struct generation_ {
 
     bdescr *       blocks;             // blocks in this gen
     unsigned int   n_blocks;           // number of blocks
-    unsigned int   n_words;             // number of words
+    unsigned int   n_words;             // number of used words
 
     bdescr *       large_objects;      // large objects (doubly linked)
     unsigned int   n_large_blocks;      // no. of blocks used by large objs
+    unsigned long  n_new_large_words;   // words of new large objects
+                                        // (for allocation stats)
 
     unsigned int   max_blocks;         // max blocks
-    bdescr        *mut_list;           // mut objects in this gen (not G0)
-    
+
     StgTSO *       threads;             // threads in this gen
                                         // linked via global_link
     struct generation_ *to;            // destination gen for live objects
@@ -100,8 +101,6 @@ typedef struct generation_ {
     unsigned int n_old_blocks;         // number of blocks in from-space
     unsigned int live_estimate;         // for sweeping: estimate of live data
     
-    bdescr *     saved_mut_list;
-
     bdescr *     part_blocks;           // partially-full scanned blocks
     unsigned int n_part_blocks;         // count of above
 
@@ -153,7 +152,7 @@ void * allocateExec(unsigned int len, void **exec_addr);
 void   freeExec (void *p);
 
 // Used by GC checks in external .cmm code:
-extern nat alloc_blocks_lim;
+extern nat large_alloc_lim;
 
 /* -----------------------------------------------------------------------------
    Performing Garbage Collection
@@ -166,10 +165,20 @@ void performMajorGC(void);
    The CAF table - used to let us revert CAFs in GHCi
    -------------------------------------------------------------------------- */
 
-void newCAF     (StgClosure*);
-void newDynCAF  (StgClosure *);
+void newCAF     (StgRegTable *reg, StgClosure *);
+void newDynCAF  (StgRegTable *reg, StgClosure *);
 void revertCAFs (void);
 
+// Request that all CAFs are retained indefinitely.
+void setKeepCAFs (void);
+
+/* -----------------------------------------------------------------------------
+   Stats
+   -------------------------------------------------------------------------- */
+
+// Returns the total number of bytes allocated since the start of the program.
+HsInt64 getAllocations (void);
+
 /* -----------------------------------------------------------------------------
    This is the write barrier for MUT_VARs, a.k.a. IORefs.  A
    MUT_VAR_CLEAN object is not on the mutable list; a MUT_VAR_DIRTY
@@ -185,9 +194,9 @@ extern rtsBool keepCAFs;
 
 INLINE_HEADER void initBdescr(bdescr *bd, generation *gen, generation *dest)
 {
-    bd->gen    = gen;
-    bd->gen_no = gen->no;
-    bd->dest   = dest;
+    bd->gen     = gen;
+    bd->gen_no  = gen->no;
+    bd->dest_no = dest->no;
 }
 
 #endif /* RTS_STORAGE_GC_H */