X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FPrinter.c;h=3e80bd1a6f08a106eaf6e164a93861b50f77d11f;hb=2fc88e736892981b8b2b46661ac11f14dc351bc8;hp=7364edd37f89a6dbcd1f71cf34b9d67d94b59c2a;hpb=edb58a77c7d4aa4c17e3114fe7ac733df5e745ab;p=ghc-hetmet.git diff --git a/rts/Printer.c b/rts/Printer.c index 7364edd..3e80bd1 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -138,7 +138,7 @@ printClosure( StgClosure *obj ) StgWord i, j; #ifdef PROFILING - debugBelch("%s(", info->prof.closure_desc); + debugBelch("%s(", GET_PROF_DESC(info)); debugBelch("%s", obj->header.prof.ccs->cc->label); #else debugBelch("CONSTR("); @@ -174,7 +174,7 @@ printClosure( StgClosure *obj ) case THUNK_STATIC: /* ToDo: will this work for THUNK_STATIC too? */ #ifdef PROFILING - printThunkObject((StgThunk *)obj,info->prof.closure_desc); + printThunkObject((StgThunk *)obj,GET_PROF_DESC(info)); #else printThunkObject((StgThunk *)obj,"THUNK"); #endif @@ -340,7 +340,8 @@ printClosure( StgClosure *obj ) debugBelch("MUT_ARR_PTRS_FROZEN(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs); break; - case MVAR: + case MVAR_CLEAN: + case MVAR_DIRTY: { StgMVar* mv = (StgMVar*)obj; debugBelch("MVAR(head=%p, tail=%p, value=%p)\n", mv->head, mv->tail, mv->value); @@ -1064,11 +1065,37 @@ extern void DEBUG_LoadSymbols( char *name STG_UNUSED ) void findPtr(P_ p, int); /* keep gcc -Wall happy */ +int searched = 0; + +static int +findPtrBlocks (StgPtr p, bdescr *bd, StgPtr arr[], int arr_size, int i) +{ + StgPtr q, r; + for (; bd; bd = bd->link) { + searched++; + for (q = bd->start; q < bd->free; q++) { + if (UNTAG_CLOSURE((StgClosure*)*q) == (StgClosure *)p) { + if (i < arr_size) { + r = q; + while (HEAP_ALLOCED((StgPtr)*r) || !LOOKS_LIKE_INFO_PTR(*r) || (P_)*r == NULL) { + r--; + } + debugBelch("%p = ", r); + printClosure((StgClosure *)r); + arr[i++] = r; + } else { + return i; + } + } + } + } + return i; +} + void findPtr(P_ p, int follow) { nat s, g; - P_ q, r; bdescr *bd; #if defined(__GNUC__) const int arr_size = 1024; @@ -1077,27 +1104,15 @@ findPtr(P_ p, int follow) #endif StgPtr arr[arr_size]; int i = 0; + searched = 0; for (g = 0; g < RtsFlags.GcFlags.generations; g++) { for (s = 0; s < generations[g].n_steps; s++) { bd = generations[g].steps[s].blocks; - for (; bd; bd = bd->link) { - for (q = bd->start; q < bd->free; q++) { - if (*q == (W_)p) { - if (i < arr_size) { - r = q; - while (!LOOKS_LIKE_INFO_PTR(*r) || (P_)*r == NULL) { - r--; - } - debugBelch("%p = ", r); - printClosure((StgClosure *)r); - arr[i++] = r; - } else { - return; - } - } - } - } + i = findPtrBlocks(p,bd,arr,arr_size,i); + bd = generations[g].steps[s].large_objects; + i = findPtrBlocks(p,bd,arr,arr_size,i); + if (i >= arr_size) return; } } if (follow && i == 1) { @@ -1164,7 +1179,7 @@ void prettyPrintClosure_ (StgClosure *obj) con_info = get_con_itbl (obj); /* obtain the name of the constructor */ - descriptor = con_info->con_desc; + descriptor = GET_CON_DESC(con_info); debugBelch ("(%s", descriptor);