X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fsm%2FEvac.c;h=35939430a2c5a15f7edf6221e1c29b994cf7b5c2;hb=797dca87dcc96224ee7e96e852c4381266533597;hp=fc344f90fd3d4528c6ec340d27012cbe142bce9d;hpb=f7de2e9478d6f43090c8a0b38a4bdb282b001c8f;p=ghc-hetmet.git diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c index fc344f9..3593943 100644 --- a/rts/sm/Evac.c +++ b/rts/sm/Evac.c @@ -37,7 +37,6 @@ alloc_for_copy (nat size, step *stp) { StgPtr to; step_workspace *ws; - bdescr *bd; /* Find out where we're going, using the handy "to" pointer in * the step of the source object. If it turns out we need to @@ -57,17 +56,18 @@ alloc_for_copy (nat size, step *stp) /* chain a new block onto the to-space for the destination step if * necessary. */ - bd = ws->todo_bd; - to = bd->free; - if (to + size >= bd->start + BLOCK_SIZE_W) { - bd = gc_alloc_todo_block(ws); - to = bd->free; + + ASSERT(ws->todo_free >= ws->todo_bd->free && ws->todo_free <= ws->todo_lim); + to = ws->todo_free; + if (to + size >= ws->todo_lim) { + to = gc_alloc_todo_block(ws); } - bd->free = to + size; + ws->todo_free = to + size; + ASSERT(ws->todo_free >= ws->todo_bd->free && ws->todo_free <= ws->todo_lim); return to; } - + /* ----------------------------------------------------------------------------- The evacuate() code -------------------------------------------------------------------------- */ @@ -164,7 +164,11 @@ unchain_thunk_selectors(StgSelector *p, StgClosure *val) prev = NULL; while (p) { +#ifdef THREADED_RTS + ASSERT(p->header.info == &stg_WHITEHOLE_info); +#else ASSERT(p->header.info == &stg_BLACKHOLE_info); +#endif prev = (StgSelector*)((StgClosure *)p)->payload[0]; // Update the THUNK_SELECTOR with an indirection to the @@ -400,13 +404,11 @@ bale_out: // We didn't manage to evaluate this thunk; restore the old info // pointer. But don't forget: we still need to evacuate the thunk itself. SET_INFO(p, (const StgInfoTable *)info_ptr); + *q = (StgClosure *)p; if (evac) { - copy(&val,(StgClosure *)p,THUNK_SELECTOR_sizeW(),bd->step->to); - } else { - val = (StgClosure *)p; + copy(q,(StgClosure *)p,THUNK_SELECTOR_sizeW(),bd->step->to); } - *q = val; - unchain_thunk_selectors(prev_thunk_selector, val); + unchain_thunk_selectors(prev_thunk_selector, *q); return; }