// it at the *front* of the nursery list, and use it
// to allocate() from.
reg->rCurrentNursery->link = bd->link;
+ if (bd->link != NULL) {
+ bd->link->u.back = reg->rCurrentNursery;
+ }
}
dbl_link_onto(bd, ®->rNursery->blocks);
reg->rCurrentAlloc = bd;
+ IF_DEBUG(sanity, checkNurserySanity(reg->rNursery));
}
}
p = bd->free;
allocated = allocated_bytes();
allocated += countNurseryBlocks() * BLOCK_SIZE_W;
+ {
#ifdef SMP
nat i;
for (i = 0; i < n_nurseries; i++) {
- current_nursery->free;
}
#endif
+ }
total_allocated += allocated;
return allocated;
}
}
+/* Nursery sanity check */
+void
+checkNurserySanity( step *stp )
+{
+ bdescr *bd, *prev;
+ nat blocks = 0;
+
+ prev = NULL;
+ for (bd = stp->blocks; bd != NULL; bd = bd->link) {
+ ASSERT(bd->u.back == prev);
+ prev = bd;
+ blocks += bd->blocks;
+ }
+ ASSERT(blocks == stp->n_blocks);
+}
+
// handy function for use in gdb, because Bdescr() is inlined.
extern bdescr *_bdescr( StgPtr p );