small optimisation: when evacuating a TSO, only copy the part of the
stack that is above the stack pointer and hence in use (doesn't apply
to most stacks, which are large objects and don't get copied anyhow).
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.155 2003/05/14 09:13:59 simonmar Exp $
+ * $Id: GC.c,v 1.156 2003/06/19 12:47:08 simonmar Exp $
*
* (c) The GHC Team 1998-2003
*
*
* (c) The GHC Team 1998-2003
*
- StgTSO *new_tso = (StgTSO *)copy((StgClosure *)tso,tso_sizeW(tso),stp);
+ StgTSO *new_tso;
+ StgPtr p, q;
+
+ new_tso = (StgTSO *)copyPart((StgClosure *)tso,
+ tso_sizeW(tso),
+ sizeofW(StgTSO), stp);
+ for (p = tso->sp, q = new_tso->sp;
+ p < tso->stack+tso->stack_size;) {
+ *q++ = *p++;
+ }
+
return (StgClosure *)new_tso;
}
}
return (StgClosure *)new_tso;
}
}
- // relocate the stack pointers...
+ // relocate the stack pointer...
diff = (StgPtr)dest - (StgPtr)src; // In *words*
dest->sp = (StgPtr)dest->sp + diff;
}
diff = (StgPtr)dest - (StgPtr)src; // In *words*
dest->sp = (StgPtr)dest->sp + diff;
}