Keep track of an accurate count of live words in each step
[ghc-hetmet.git] / rts / sm / GC.h
index f98e4a1..5a9cb98 100644 (file)
    ------------------------------------------------------------------------- */
 
 typedef struct step_workspace_ {
-    step * stp;                        // the step for this workspace 
+    step * step;               // the step for this workspace 
     struct gc_thread_ * gct;    // the gc_thread that contains this workspace
 
     // block that is currently being scanned
     bdescr *     scan_bd;
-    StgPtr       scan;               // the scan pointer
 
     // where objects to be scavenged go
     bdescr *     todo_bd;
@@ -91,9 +90,13 @@ typedef struct step_workspace_ {
     // where large objects to be scavenged go
     bdescr *     todo_large_objects;
 
-    // Objects that need not be, or have already been, scavenged.
+    // Objects that have already been, scavenged.
     bdescr *     scavd_list;
-    lnat         n_scavd_blocks;     // count of blocks in this list
+    nat          n_scavd_blocks;     // count of blocks in this list
+
+    // Partially-full, scavenged, blocks
+    bdescr *     part_list;
+    unsigned int n_part_blocks;      // count of above
 
 } step_workspace;
 
@@ -120,6 +123,9 @@ typedef struct gc_thread_ {
                                    //  during GC without accessing the block
                                    //   allocators spin lock. 
 
+    StgClosure* static_objects;      // live static objects
+    StgClosure* scavenged_static_objects;   // static objects scavenged so far
+
     lnat gc_count;                 // number of gc's this thread has done
 
     // --------------------
@@ -134,7 +140,7 @@ typedef struct gc_thread_ {
                                    // variable).
 
     rtsBool failed_to_evac;        // failure to evacuate an object typically 
-                                   // causes it to be recorded in the mutable 
+                                   // Causes it to be recorded in the mutable 
                                    // object list
 
     rtsBool eager_promotion;       // forces promotion to the evac gen
@@ -148,6 +154,14 @@ typedef struct gc_thread_ {
 #endif
 
     // -------------------
+    // stats
+
+    lnat copied;
+    lnat any_work;
+    lnat no_work;
+    lnat scav_find_work;
+
+    // -------------------
     // workspaces
 
     // array of workspaces, indexed by stp->abs_no.  This is placed
@@ -160,14 +174,12 @@ typedef struct gc_thread_ {
 
 extern nat N;
 extern rtsBool major_gc;
+extern nat n_gc_threads;
 
 extern gc_thread **gc_threads;
 register gc_thread *gct __asm__("%rbx");
 // extern gc_thread *gct;  // this thread's gct TODO: make thread-local
 
-extern StgClosure* static_objects;
-extern StgClosure* scavenged_static_objects;
-
 extern bdescr *mark_stack_bdescr;
 extern StgPtr *mark_stack;
 extern StgPtr *mark_sp;
@@ -179,14 +191,12 @@ extern StgPtr  oldgen_scan;
 
 extern long copied;
 
-#ifdef THREADED_RTS
-extern SpinLock static_objects_sync;
-#endif
-
 #ifdef DEBUG
 extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS;
 #endif
 
 StgClosure * isAlive(StgClosure *p);
 
+#define WORK_UNIT_WORDS 128
+
 #endif /* GC_H */