tell Emacs these files are C
[ghc-hetmet.git] / rts / sm / Evac.c-inc
index 6fa93d1..0f2cc6d 100644 (file)
@@ -1,4 +1,4 @@
-/* -----------------------------------------------------------------------------
+/* -----------------------------------------------------------------------*-c-*-
  *
  * (c) The GHC Team 1998-2006
  *
@@ -23,7 +23,7 @@
 #endif
 
 STATIC_INLINE void
-copy_tag(StgClosure **p, StgClosure *src, nat size, step *stp)
+copy_tag(StgClosure **p, StgClosure *src, nat size, step *stp, StgWord tag)
 {
     StgPtr to, tagged_to, from;
     nat i;
@@ -34,11 +34,14 @@ copy_tag(StgClosure **p, StgClosure *src, nat size, step *stp)
        info = xchg((StgPtr)&src->header.info, (W_)&stg_WHITEHOLE_info);
        // so..  what is it?
     } while (info == (W_)&stg_WHITEHOLE_info);
-    if (info == (W_)&stg_EVACUATED_info) {
+    if (info == (W_)&stg_EVACUATED_info || info == (W_)&stg_IND_info) {
+        // NB. a closure might be updated with an IND by
+        // unchain_selector_thunks(), hence the test above.
        src->header.info = (const StgInfoTable *)info;
        return evacuate(p); // does the failed_to_evac stuff
     }
 #else
+    ASSERT(n_gc_threads == 1);
     info = (W_)src->header.info;
     src->header.info = &stg_EVACUATED_info;
 #endif
@@ -353,7 +356,7 @@ loop:
                             (StgClosure *)CHARLIKE_CLOSURE((StgChar)w)
                           );
       }
-      if (q->header.info == Izh_con_info &&
+      else if (q->header.info == Izh_con_info &&
          (StgInt)w >= MIN_INTLIKE && (StgInt)w <= MAX_INTLIKE) {
          *p = TAG_CLOSURE(tag,
                             (StgClosure *)INTLIKE_CLOSURE((StgInt)w)
@@ -482,7 +485,7 @@ loop:
       StgClosure *e = ((StgEvacuated*)q)->evacuee;
       *p = e;
       if (stp < gct->evac_step) {  // optimisation 
-         if (HEAP_ALLOCED(e) && Bdescr((P_)e)->step < gct->evac_step) {
+         if (Bdescr((P_)e)->step < gct->evac_step) {
              gct->failed_to_evac = rtsTrue;
              TICK_GC_FAILED_PROMOTION();
          }
@@ -563,3 +566,8 @@ loop:
 
   barf("evacuate");
 }
+
+#undef copy
+#undef copy_tag
+#undef copyPart
+#undef evacuate