-
- case IND:
- case IND_OLDGEN:
- // follow chains of indirections, don't evacuate them
- q = ((StgInd*)q)->indirectee;
- goto loop;
-
- case RET_BCO:
- case RET_SMALL:
- case RET_BIG:
- case RET_DYN:
- case UPDATE_FRAME:
- case STOP_FRAME:
- case CATCH_FRAME:
- case CATCH_STM_FRAME:
- case CATCH_RETRY_FRAME:
- case ATOMICALLY_FRAME:
- // shouldn't see these
- barf("evacuate: stack frame at %p\n", q);
-
- case PAP:
- return copy(q,pap_sizeW((StgPAP*)q),stp);
-
- case AP:
- return copy(q,ap_sizeW((StgAP*)q),stp);
-
- case AP_STACK:
- return copy(q,ap_stack_sizeW((StgAP_STACK*)q),stp);
-
- case EVACUATED:
- /* Already evacuated, just return the forwarding address.
- * HOWEVER: if the requested destination generation (evac_gen) is
- * older than the actual generation (because the object was
- * already evacuated to a younger generation) then we have to
- * set the failed_to_evac flag to indicate that we couldn't
- * manage to promote the object to the desired generation.
- */
- /*
- * Optimisation: the check is fairly expensive, but we can often
- * shortcut it if either the required generation is 0, or the
- * current object (the EVACUATED) is in a high enough generation.
- * We know that an EVACUATED always points to an object in the
- * same or an older generation. stp is the lowest step that the
- * current object would be evacuated to, so we only do the full
- * check if stp is too low.
- */
- if (evac_gen > 0 && stp->gen_no < evac_gen) { // optimisation
- StgClosure *p = ((StgEvacuated*)q)->evacuee;
- if (HEAP_ALLOCED(p) && Bdescr((P_)p)->gen_no < evac_gen) {
- failed_to_evac = rtsTrue;
- TICK_GC_FAILED_PROMOTION();
- }
- }
- return ((StgEvacuated*)q)->evacuee;
-
- case ARR_WORDS:
- // just copy the block
- return copy_noscav(q,arr_words_sizeW((StgArrWords *)q),stp);
-
- case MUT_ARR_PTRS_CLEAN:
- case MUT_ARR_PTRS_DIRTY:
- case MUT_ARR_PTRS_FROZEN:
- case MUT_ARR_PTRS_FROZEN0:
- // just copy the block
- return copy(q,mut_arr_ptrs_sizeW((StgMutArrPtrs *)q),stp);
-
- case TSO:
- {
- StgTSO *tso = (StgTSO *)q;
-
- /* Deal with redirected TSOs (a TSO that's had its stack enlarged).
- */
- if (tso->what_next == ThreadRelocated) {
- q = (StgClosure *)tso->link;
- goto loop;
- }
-
- /* To evacuate a small TSO, we need to relocate the update frame
- * list it contains.
- */
- {
- StgTSO *new_tso;
- StgPtr p, q;
-
- new_tso = (StgTSO *)copyPart((StgClosure *)tso,
- tso_sizeW(tso),
- sizeofW(StgTSO), stp);
- move_TSO(tso, new_tso);
- for (p = tso->sp, q = new_tso->sp;
- p < tso->stack+tso->stack_size;) {
- *q++ = *p++;
- }
-
- return (StgClosure *)new_tso;
- }
- }
-
- case TREC_HEADER:
- return copy(q,sizeofW(StgTRecHeader),stp);
-
- case TVAR_WATCH_QUEUE:
- return copy(q,sizeofW(StgTVarWatchQueue),stp);
-
- case TVAR:
- return copy(q,sizeofW(StgTVar),stp);
-
- case TREC_CHUNK:
- return copy(q,sizeofW(StgTRecChunk),stp);
-
- case ATOMIC_INVARIANT:
- return copy(q,sizeofW(StgAtomicInvariant),stp);
-
- case INVARIANT_CHECK_QUEUE:
- return copy(q,sizeofW(StgInvariantCheckQueue),stp);
-
- default:
- barf("evacuate: strange closure type %d", (int)(info->type));
- }
-
- barf("evacuate");