cache bd->todo_bd->free and the limit in the workspace
[ghc-hetmet.git] / rts / sm / Scav.c
index 17e519d..7ee97c9 100644 (file)
@@ -275,7 +275,7 @@ linear_scan:
        info = get_itbl((StgClosure *)p);
        
        q = p;
-       switch (info->type) {
+        switch (((volatile StgWord *)info)[1] & 0xffff) {
            
         case MVAR_CLEAN:
         case MVAR_DIRTY:
@@ -1409,8 +1409,8 @@ scavenge_find_global_work (void)
     step_workspace *ws;
 
     flag = rtsFalse;
-    for (g = RtsFlags.GcFlags.generations; --g >= 0; ) {
-       for (s = generations[g].n_steps; --s >= 0; ) {
+    for (g = RtsFlags.GcFlags.generations-1; g >= 0; g--) {
+       for (s = generations[g].n_steps-1; s >= 0; s--) {
            if (g == 0 && s == 0 && RtsFlags.GcFlags.generations > 1) { 
                continue; 
            }
@@ -1469,6 +1469,11 @@ scavenge_find_local_work (void)
            }
            ws = &gct->steps[g][s];
 
+            if (ws->todo_bd != NULL)
+            {
+                ws->todo_bd->free = ws->todo_free;
+            }
+
            // If we have a todo block and no scan block, start
            // scanning the todo block.
            if (ws->scan_bd == NULL && ws->todo_bd != NULL)
@@ -1568,8 +1573,8 @@ any_work (void)
     // Check for global work in any step.  We don't need to check for
     // local work, because we have already exited scavenge_loop(),
     // which means there is no local work for this thread.
-    for (g = RtsFlags.GcFlags.generations; --g >= 0; ) {
-       for (s = generations[g].n_steps; --s >= 0; ) {
+    for (g = RtsFlags.GcFlags.generations-1; g >= 0; g--) {
+       for (s = generations[g].n_steps-1; s >= 0; s--) {
            if (g == 0 && s == 0 && RtsFlags.GcFlags.generations > 1) { 
                continue; 
            }