RTS tidyup sweep, first phase
[ghc-hetmet.git] / rts / sm / GC.h
index 519925e..920b464 100644 (file)
@@ -1,22 +1,28 @@
 /* -----------------------------------------------------------------------------
  *
- * (c) The GHC Team 1998-2006
+ * (c) The GHC Team 1998-2008
  *
  * Generational garbage collector
  *
+ * Documentation on the architecture of the Garbage Collector can be
+ * found in the online commentary:
+ * 
+ *   http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC
+ *
  * ---------------------------------------------------------------------------*/
 
-#ifndef GC_H
-#define GC_H
+#ifndef SM_GC_H
+#define SM_GC_H
+
+void GarbageCollect(rtsBool force_major_gc, nat gc_type, Capability *cap);
+
+typedef void (*evac_fn)(void *user, StgClosure **root);
+
+StgClosure * isAlive      ( StgClosure *p );
+void         markCAFs     ( evac_fn evac, void *user );
 
 extern nat N;
 extern rtsBool major_gc;
-extern nat evac_gen;
-extern rtsBool eager_promotion;
-extern rtsBool failed_to_evac;
-
-extern StgClosure* static_objects;
-extern StgClosure* scavenged_static_objects;
 
 extern bdescr *mark_stack_bdescr;
 extern StgPtr *mark_stack;
@@ -27,13 +33,31 @@ extern rtsBool mark_stack_overflowed;
 extern bdescr *oldgen_scan_bd;
 extern StgPtr  oldgen_scan;
 
-extern lnat new_blocks;                 // blocks allocated during this GC 
-extern lnat new_scavd_blocks;   // ditto, but depth-first blocks
+extern long copied;
+
+extern rtsBool work_stealing;
 
 #ifdef DEBUG
-extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_OTHERS;
+extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS;
+#endif
+
+#ifdef THREADED_RTS
+extern SpinLock gc_alloc_block_sync;
+#endif
+
+#if defined(PROF_SPIN) && defined(THREADED_RTS)
+extern StgWord64 whitehole_spin;
+#endif
+
+void gcWorkerThread (Capability *cap);
+void initGcThreads (void);
+void freeGcThreads (void);
+
+#if defined(THREADED_RTS)
+void waitForGcThreads (Capability *cap);
+void releaseGCThreads (Capability *cap);
 #endif
 
-StgClosure * isAlive(StgClosure *p);
+#define WORK_UNIT_WORDS 128
 
-#endif /* GC_H */
+#endif /* SM_GC_H */