[project @ 2005-07-26 15:16:40 by simonmar]
[ghc-hetmet.git] / ghc / rts / GC.c
index cce7f3f..aa3d1bc 100644 (file)
@@ -1981,6 +1981,7 @@ loop:
            // q is still BLACKHOLE'd.
            thunk_selector_depth++;
            val = evacuate(p);
+           thunk_selector_depth--;
 
            // Update the THUNK_SELECTOR with an indirection to the
            // EVACUATED closure now at p.  Why do this rather than
@@ -3062,7 +3063,9 @@ scavenge(step *stp)
      */
     if (failed_to_evac) {
        failed_to_evac = rtsFalse;
-       recordMutableGen((StgClosure *)q, stp->gen);
+       if (stp->gen_no > 0) {
+           recordMutableGen((StgClosure *)q, stp->gen);
+       }
     }
   }
 
@@ -3399,7 +3402,9 @@ linear_scan:
 
        if (failed_to_evac) {
            failed_to_evac = rtsFalse;
-           recordMutableGen((StgClosure *)q, &generations[evac_gen]);
+           if (evac_gen > 0) {
+               recordMutableGen((StgClosure *)q, &generations[evac_gen]);
+           }
        }
        
        // mark the next bit to indicate "scavenged"
@@ -4074,7 +4079,9 @@ scavenge_large(step *stp)
 
     p = bd->start;
     if (scavenge_one(p)) {
-       recordMutableGen((StgClosure *)p, stp->gen);
+       if (stp->gen_no > 0) {
+           recordMutableGen((StgClosure *)p, stp->gen);
+       }
     }
   }
 }