do a bit of by-hand CSE
[ghc-hetmet.git] / rts / sm / Evac.c
index 37cbee5..9a5f278 100644 (file)
@@ -415,8 +415,7 @@ loop:
           * on the CAF list, so don't do anything with it here (we'll
           * scavenge it later).
           */
-         if (((StgIndStatic *)q)->saved_info == NULL) {
-             if (*IND_STATIC_LINK((StgClosure *)q) == NULL) {
+          if (*IND_STATIC_LINK((StgClosure *)q) == NULL) {
 #ifndef THREADED_RTS
                  *IND_STATIC_LINK((StgClosure *)q) = gct->static_objects;
                  gct->static_objects = (StgClosure *)q;
@@ -429,7 +428,6 @@ loop:
                       gct->static_objects = (StgClosure *)q;
                   }
 #endif
-             }
          }
          return;
          
@@ -487,14 +485,7 @@ loop:
       /* evacuate large objects by re-linking them onto a different list.
        */
       if (bd->flags & BF_LARGE) {
-         info = get_itbl(q);
-         if (info->type == TSO && 
-             ((StgTSO *)q)->what_next == ThreadRelocated) {
-             q = (StgClosure *)((StgTSO *)q)->_link;
-              *p = q;
-             goto loop;
-         }
-         evacuate_large((P_)q);
+          evacuate_large((P_)q);
          return;
       }
       
@@ -622,7 +613,6 @@ loop:
 
   case FUN:
   case IND_PERM:
-  case IND_OLDGEN_PERM:
   case CONSTR:
       copy_tag_nolock(p,info,q,sizeW_fromITBL(INFO_PTR_TO_STRUCT(info)),gen,tag);
       return;
@@ -668,7 +658,6 @@ loop:
       return;
 
   case IND:
-  case IND_OLDGEN:
     // follow chains of indirections, don't evacuate them 
     q = ((StgInd*)q)->indirectee;
     *p = q;
@@ -679,6 +668,7 @@ loop:
   case RET_BIG:
   case RET_DYN:
   case UPDATE_FRAME:
+  case UNDERFLOW_FRAME:
   case STOP_FRAME:
   case CATCH_FRAME:
   case CATCH_STM_FRAME:
@@ -713,31 +703,27 @@ loop:
       return;
 
   case TSO:
-    {
-      StgTSO *tso = (StgTSO *)q;
+      copy(p,info,q,sizeofW(StgTSO),gen);
+      return;
 
-      /* Deal with redirected TSOs (a TSO that's had its stack enlarged).
-       */
-      if (tso->what_next == ThreadRelocated) {
-       q = (StgClosure *)tso->_link;
-       *p = q;
-       goto loop;
-      }
+  case STACK:
+    {
+      StgStack *stack = (StgStack *)q;
 
-      /* To evacuate a small TSO, we need to adjust the stack pointer
+      /* To evacuate a small STACK, we need to adjust the stack pointer
        */
       {
-         StgTSO *new_tso;
+          StgStack *new_stack;
          StgPtr r, s;
           rtsBool mine;
 
-         mine = copyPart(p,(StgClosure *)tso, tso_sizeW(tso), 
-                          sizeofW(StgTSO), gen);
+          mine = copyPart(p,(StgClosure *)stack, stack_sizeW(stack),
+                          sizeofW(StgStack), gen);
           if (mine) {
-              new_tso = (StgTSO *)*p;
-              move_TSO(tso, new_tso);
-              for (r = tso->sp, s = new_tso->sp;
-                   r < tso->stack+tso->stack_size;) {
+              new_stack = (StgStack *)*p;
+              move_STACK(stack, new_stack);
+              for (r = stack->sp, s = new_stack->sp;
+                   r < stack->stack + stack->stack_size;) {
                   *s++ = *r++;
               }
           }
@@ -956,7 +942,7 @@ selector_loop:
               // For the purposes of LDV profiling, we have destroyed
               // the original selector thunk, p.
               SET_INFO(p, (StgInfoTable *)info_ptr);
-              LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC((StgClosure *)p);
+              OVERWRITING_CLOSURE((StgClosure*)p);
               SET_INFO(p, &stg_WHITEHOLE_info);
 #endif
 
@@ -973,8 +959,6 @@ selector_loop:
                   switch (info->type) {
                   case IND:
                   case IND_PERM:
-                  case IND_OLDGEN:
-                  case IND_OLDGEN_PERM:
                   case IND_STATIC:
                       val = ((StgInd *)val)->indirectee;
                       goto val_loop;
@@ -1008,8 +992,6 @@ selector_loop:
 
       case IND:
       case IND_PERM:
-      case IND_OLDGEN:
-      case IND_OLDGEN_PERM:
       case IND_STATIC:
           // Again, we might need to untag a constructor.
           selectee = UNTAG_CLOSURE( ((StgInd *)selectee)->indirectee );