diff options
author | Simon Marlow <simonmar@microsoft.com> | 2007-06-13 10:29:28 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2007-06-13 10:29:28 +0000 |
commit | 23e5985c3db852981d527d10d6a6271688049790 (patch) | |
tree | 7b87dd13cdbbebb56be5e530fe524bd5694a2d22 /rts | |
parent | 62d948405f6b9a95fe4b31b7cffa387e5425d6db (diff) | |
download | haskell-23e5985c3db852981d527d10d6a6271688049790.tar.gz |
FIX #1418 (partially)
When the con_desc field of an info table was made into a relative
reference, this had the side effect of making the profiling fields
(closure_desc and closure_type) also relative, but only when compiling
via C, and the heap profiler was still treating them as absolute,
leading to crashes when profiling with -hd or -hy.
This patch fixes up the story to be consistent: these fields really
should be relative (otherwise we couldn't make shared versions of the
profiling libraries), so I've made them relative and fixed up the RTS
to know about this.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Printer.c | 4 | ||||
-rw-r--r-- | rts/ProfHeap.c | 10 | ||||
-rw-r--r-- | rts/RetainerProfile.c | 6 | ||||
-rw-r--r-- | rts/RetainerSet.c | 6 |
4 files changed, 14 insertions, 12 deletions
diff --git a/rts/Printer.c b/rts/Printer.c index b33d238476..2a0346ba4b 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 diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index e8966ece3e..ed5dc36009 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -99,6 +99,7 @@ static void dumpCensus( Census *census ); Closure Type Profiling; ------------------------------------------------------------------------- */ +#ifndef PROFILING static char *type_names[] = { "INVALID_OBJECT", "CONSTR", @@ -173,6 +174,7 @@ static char *type_names[] = { "CATCH_STM_FRAME", "N_CLOSURE_TYPES" }; +#endif /* ---------------------------------------------------------------------------- * Find the "closure identity", which is a unique pointer reresenting @@ -190,9 +192,9 @@ closureIdentity( StgClosure *p ) case HEAP_BY_MOD: return p->header.prof.ccs->cc->module; case HEAP_BY_DESCR: - return get_itbl(p)->prof.closure_desc; + return GET_PROF_DESC(get_itbl(p)); case HEAP_BY_TYPE: - return get_itbl(p)->prof.closure_type; + return GET_PROF_TYPE(get_itbl(p)); case HEAP_BY_RETAINER: // AFAIK, the only closures in the heap which might not have a // valid retainer set are DEAD_WEAK closures. @@ -645,12 +647,12 @@ closureSatisfiesConstraints( StgClosure* p ) } if (RtsFlags.ProfFlags.descrSelector) { - b = strMatchesSelector( (get_itbl((StgClosure *)p))->prof.closure_desc, + b = strMatchesSelector( (GET_PROF_DESC(get_itbl((StgClosure *)p))), RtsFlags.ProfFlags.descrSelector ); if (!b) return rtsFalse; } if (RtsFlags.ProfFlags.typeSelector) { - b = strMatchesSelector( (get_itbl((StgClosure *)p))->prof.closure_type, + b = strMatchesSelector( (GET_PROF_TYPE(get_itbl((StgClosure *)p))), RtsFlags.ProfFlags.typeSelector ); if (!b) return rtsFalse; } diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 4920e7d09d..9f29acae19 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -2110,8 +2110,8 @@ sanityCheckHeapClosure( StgClosure *c ) if ((((StgWord)RSET(c) & 1) ^ flip) != 0) { if (get_itbl(c)->type == CONSTR && - !strcmp(get_itbl(c)->prof.closure_type, "DEAD_WEAK") && - !strcmp(get_itbl(c)->prof.closure_desc, "DEAD_WEAK")) { + !strcmp(GET_PROF_TYPE(get_itbl(c)), "DEAD_WEAK") && + !strcmp(GET_PROF_DESC(get_itbl(c)), "DEAD_WEAK")) { debugBelch("\tUnvisited dead weak pointer object found: c = %p\n", c); costArray[get_itbl(c)->type] += cost(c); sumOfNewCost += cost(c); @@ -2119,7 +2119,7 @@ sanityCheckHeapClosure( StgClosure *c ) debugBelch( "Unvisited object: flip = %d, c = %p(%d, %s, %s), rs = %p\n", flip, c, get_itbl(c)->type, - get_itbl(c)->prof.closure_type, get_itbl(c)->prof.closure_desc, + get_itbl(c)->prof.closure_type, GET_PROF_DESC(get_itbl(c)), RSET(c)); } else { // debugBelch("sanityCheckHeapClosure) S: flip = %d, c = %p(%d), rs = %p\n", flip, c, get_itbl(c)->type, RSET(c)); diff --git a/rts/RetainerSet.c b/rts/RetainerSet.c index bfa0bc8acf..e1db615020 100644 --- a/rts/RetainerSet.c +++ b/rts/RetainerSet.c @@ -239,7 +239,7 @@ traverseAllRetainerSet(void (*f)(RetainerSet *)) void printRetainer(FILE *f, retainer itbl) { - fprintf(f, "%s[%s]", itbl->prof.closure_desc, itbl->prof.closure_type); + fprintf(f, "%s[%s]", GET_PROF_DESC(itbl), itbl->prof.closure_type); } #elif defined(RETAINER_SCHEME_CCS) // Retainer scheme 2: retainer = cost centre stack @@ -283,7 +283,7 @@ printRetainerSetShort(FILE *f, RetainerSet *rs) for (j = 0; j < rs->num; j++) { if (j < rs->num - 1) { - strncpy(tmp + size, rs->element[j]->prof.closure_desc, MAX_RETAINER_SET_SPACE - size); + strncpy(tmp + size, GET_PROF_DESC(rs->element[j]), MAX_RETAINER_SET_SPACE - size); size = strlen(tmp); if (size == MAX_RETAINER_SET_SPACE) break; @@ -293,7 +293,7 @@ printRetainerSetShort(FILE *f, RetainerSet *rs) break; } else { - strncpy(tmp + size, rs->element[j]->prof.closure_desc, MAX_RETAINER_SET_SPACE - size); + strncpy(tmp + size, GET_PROF_DESC(rs->element[j]), MAX_RETAINER_SET_SPACE - size); // size = strlen(tmp); } } |