/* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.146 2002/12/11 15:36:42 simonmar Exp $
+ * $Id: GC.c,v 1.149 2003/03/24 14:46:53 simonmar Exp $
*
- * (c) The GHC Team 1998-2002
+ * (c) The GHC Team 1998-2003
*
* Generational garbage collector
*
#include "Sanity.h"
#include "BlockAlloc.h"
#include "MBlock.h"
-#include "Main.h"
#include "ProfHeap.h"
#include "SchedAPI.h"
#include "Weak.h"
case WEAK:
case FOREIGN:
case STABLE_NAME:
- case BCO:
return copy(q,sizeW_fromITBL(info),stp);
+ case BCO:
+ return copy(q,bco_sizeW((StgBCO *)q),stp);
+
case CAF_BLACKHOLE:
case SE_CAF_BLACKHOLE:
case SE_BLACKHOLE:
selector_loop:
+ if (Bdescr((StgPtr)selectee)->flags & BF_EVACUATED) {
+ SET_INFO(p, info_ptr);
+ return NULL;
+ }
+
info = get_itbl(selectee);
switch (info->type) {
case CONSTR:
// because we are guaranteed that p is in a generation
// that we are collecting, and we never want to put the
// indirection on a mutable list.
+#ifdef PROFILING
+ // For the purposes of LDV profiling, we have destroyed
+ // the original selector thunk.
+ SET_INFO(p, info_ptr);
+ LDV_recordDead_FILL_SLOP_DYNAMIC(selectee);
+#endif
((StgInd *)selectee)->indirectee = val;
SET_INFO(selectee,&stg_IND_info);
+#ifdef PROFILING
+ // For the purposes of LDV profiling, we have created an
+ // indirection.
+ LDV_recordCreate(selectee);
+#endif
selectee = val;
goto selector_loop;
}
case WEAK:
case FOREIGN:
case STABLE_NAME:
- case BCO:
{
StgPtr end;
break;
}
+ case BCO: {
+ StgBCO *bco = (StgBCO *)p;
+ (StgClosure *)bco->instrs = evacuate((StgClosure *)bco->instrs);
+ (StgClosure *)bco->literals = evacuate((StgClosure *)bco->literals);
+ (StgClosure *)bco->ptrs = evacuate((StgClosure *)bco->ptrs);
+ (StgClosure *)bco->itbls = evacuate((StgClosure *)bco->itbls);
+ p += bco_sizeW(bco);
+ break;
+ }
+
case IND_PERM:
if (stp->gen->no != 0) {
#ifdef PROFILING
case WEAK:
case FOREIGN:
case STABLE_NAME:
- case BCO:
{
StgPtr end;
break;
}
+ case BCO: {
+ StgBCO *bco = (StgBCO *)p;
+ (StgClosure *)bco->instrs = evacuate((StgClosure *)bco->instrs);
+ (StgClosure *)bco->literals = evacuate((StgClosure *)bco->literals);
+ (StgClosure *)bco->ptrs = evacuate((StgClosure *)bco->ptrs);
+ (StgClosure *)bco->itbls = evacuate((StgClosure *)bco->itbls);
+ break;
+ }
+
case IND_PERM:
// don't need to do anything here: the only possible case
// is that we're in a 1-space compacting collector, with