X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FSanity.c;h=3f4b3cf7b05a81f0edf68b26f493f4d276f0028d;hb=de75026f5a48d3d052135a973ab4dff76c5b20f5;hp=25a76c00002d1f44df85b13b1fa4dc25e8ed88e0;hpb=770dd8113b313be8c1db889e82c4a8bf8a553ad5;p=ghc-hetmet.git diff --git a/rts/Sanity.c b/rts/Sanity.c index 25a76c0..3f4b3cf 100644 --- a/rts/Sanity.c +++ b/rts/Sanity.c @@ -204,12 +204,13 @@ checkStackChunk( StgPtr sp, StgPtr stack_end ) } static void -checkPAP (StgClosure *fun, StgClosure** payload, StgWord n_args) +checkPAP (StgClosure *tagged_fun, StgClosure** payload, StgWord n_args) { + StgClosure *fun; StgClosure *p; StgFunInfoTable *fun_info; - fun = UNTAG_CLOSURE(fun); + fun = UNTAG_CLOSURE(tagged_fun); ASSERT(LOOKS_LIKE_CLOSURE_PTR(fun)); fun_info = get_fun_itbl(fun); @@ -236,8 +237,8 @@ checkPAP (StgClosure *fun, StgClosure** payload, StgWord n_args) break; } - ASSERT(fun_info->f.arity > TAG_MASK ? GET_CLOSURE_TAG(fun) == 1 - : GET_CLOSURE_TAG(fun) == fun_info->f.arity); + ASSERT(fun_info->f.arity > TAG_MASK ? GET_CLOSURE_TAG(tagged_fun) == 1 + : GET_CLOSURE_TAG(tagged_fun) == fun_info->f.arity); } @@ -246,7 +247,7 @@ checkClosure( StgClosure* p ) { const StgInfoTable *info; - ASSERT(LOOKS_LIKE_INFO_PTR(p->header.info)); + ASSERT(LOOKS_LIKE_CLOSURE_PTR(p)); p = UNTAG_CLOSURE(p); /* Is it a static closure (i.e. in the data segment)? */ @@ -256,7 +257,13 @@ checkClosure( StgClosure* p ) ASSERT(!closure_STATIC(p)); } - info = get_itbl(p); + info = p->header.info; + + if (IS_FORWARDING_PTR(info)) { + barf("checkClosure: found EVACUATED closure %d", info->type); + } + info = INFO_PTR_TO_STRUCT(info); + switch (info->type) { case MVAR_CLEAN: @@ -305,10 +312,6 @@ checkClosure( StgClosure* p ) case IND_PERM: case IND_OLDGEN: case IND_OLDGEN_PERM: -#ifdef TICKY_TICKY - case SE_BLACKHOLE: - case SE_CAF_BLACKHOLE: -#endif case BLACKHOLE: case CAF_BLACKHOLE: case STABLE_NAME: @@ -505,10 +508,6 @@ checkClosure( StgClosure* p ) return sizeofW(StgTRecHeader); } - - case EVACUATED: - barf("checkClosure: found EVACUATED closure %d", - info->type); default: barf("checkClosure (closure type %d)", info->type); } @@ -584,7 +583,7 @@ checkHeap(bdescr *bd) /* skip over slop */ while (p < bd->free && - (*p < 0x1000 || !LOOKS_LIKE_INFO_PTR((void*)*p))) { p++; } + (*p < 0x1000 || !LOOKS_LIKE_INFO_PTR(*p))) { p++; } } } } @@ -625,7 +624,7 @@ checkHeapChunk(StgPtr start, StgPtr end) nat size; for (p=start; p= MIN_PAYLOAD_SIZE + sizeofW(StgHeader) ); @@ -634,10 +633,12 @@ checkHeapChunk(StgPtr start, StgPtr end) #endif void -checkChain(bdescr *bd) +checkLargeObjects(bdescr *bd) { while (bd != NULL) { - checkClosure((StgClosure *)bd->start); + if (!(bd->flags & BF_PINNED)) { + checkClosure((StgClosure *)bd->start); + } bd = bd->link; } } @@ -651,7 +652,7 @@ checkTSO(StgTSO *tso) StgPtr stack_end = stack + stack_size; if (tso->what_next == ThreadRelocated) { - checkTSO(tso->link); + checkTSO(tso->_link); return; } @@ -780,13 +781,25 @@ checkThreadQsSanity (rtsBool check_TSO_too) void checkGlobalTSOList (rtsBool checkTSOs) { - extern StgTSO *all_threads; StgTSO *tso; - for (tso=all_threads; tso != END_TSO_QUEUE; tso = tso->global_link) { - ASSERT(LOOKS_LIKE_CLOSURE_PTR(tso)); - ASSERT(get_itbl(tso)->type == TSO); - if (checkTSOs) - checkTSO(tso); + nat s; + + for (s = 0; s < total_steps; s++) { + for (tso=all_steps[s].threads; tso != END_TSO_QUEUE; + tso = tso->global_link) { + ASSERT(LOOKS_LIKE_CLOSURE_PTR(tso)); + ASSERT(get_itbl(tso)->type == TSO); + if (checkTSOs) + checkTSO(tso); + + // If this TSO is dirty and in an old generation, it better + // be on the mutable list. + if (tso->what_next == ThreadRelocated) continue; + if (tso->flags & (TSO_DIRTY|TSO_LINK_DIRTY)) { + ASSERT(Bdescr((P_)tso)->gen_no == 0 || (tso->flags & TSO_MARKED)); + tso->flags &= ~TSO_MARKED; + } + } } } @@ -805,10 +818,27 @@ checkMutableList( bdescr *mut_bd, nat gen ) for (q = bd->start; q < bd->free; q++) { p = (StgClosure *)*q; ASSERT(!HEAP_ALLOCED(p) || Bdescr((P_)p)->gen_no == gen); + if (get_itbl(p)->type == TSO) { + ((StgTSO *)p)->flags |= TSO_MARKED; + } } } } +void +checkMutableLists (rtsBool checkTSOs) +{ + nat g, i; + + for (g = 0; g < RtsFlags.GcFlags.generations; g++) { + checkMutableList(generations[g].mut_list, g); + for (i = 0; i < n_capabilities; i++) { + checkMutableList(capabilities[i].mut_lists[g], g); + } + } + checkGlobalTSOList(checkTSOs); +} + /* Check the static objects list. */ @@ -827,7 +857,7 @@ checkStaticObjects ( StgClosure* static_objects ) StgClosure *indirectee = UNTAG_CLOSURE(((StgIndStatic *)p)->indirectee); ASSERT(LOOKS_LIKE_CLOSURE_PTR(indirectee)); - ASSERT(LOOKS_LIKE_INFO_PTR(indirectee->header.info)); + ASSERT(LOOKS_LIKE_INFO_PTR((StgWord)indirectee->header.info)); p = *IND_STATIC_LINK((StgClosure *)p); break; }