avoid uninitialized value warnings from valgrind when DebugFrameMaps is true

This commit is contained in:
Joel Dice 2008-11-25 16:01:30 -07:00
parent 58a9718d82
commit fdb9c05ac6

View File

@ -37,6 +37,8 @@ const bool CheckArrayBounds = true;
const unsigned MaxNativeCallFootprint = 4; const unsigned MaxNativeCallFootprint = 4;
const unsigned InitialZoneCapacityInBytes = 64 * 1024;
class MyThread: public Thread { class MyThread: public Thread {
public: public:
class CallTrace { class CallTrace {
@ -530,7 +532,7 @@ class Context {
Context(MyThread* t, object method): Context(MyThread* t, object method):
thread(t), thread(t),
zone(t->m->system, t->m->heap, 64 * 1024), zone(t->m->system, t->m->heap, InitialZoneCapacityInBytes),
assembler(makeAssembler(t->m->system, t->m->heap, &zone, t->arch)), assembler(makeAssembler(t->m->system, t->m->heap, &zone, t->arch)),
client(t), client(t),
compiler(makeCompiler(t->m->system, assembler, &zone, &client)), compiler(makeCompiler(t->m->system, assembler, &zone, &client)),
@ -546,7 +548,7 @@ class Context {
Context(MyThread* t): Context(MyThread* t):
thread(t), thread(t),
zone(t->m->system, t->m->heap, LikelyPageSizeInBytes), zone(t->m->system, t->m->heap, InitialZoneCapacityInBytes),
assembler(makeAssembler(t->m->system, t->m->heap, &zone, t->arch)), assembler(makeAssembler(t->m->system, t->m->heap, &zone, t->arch)),
client(t), client(t),
compiler(0), compiler(0),
@ -3655,13 +3657,15 @@ translateLineNumberTable(MyThread* t, Compiler* c, object code, intptr_t start)
} }
void void
printSet(uintptr_t m) printSet(uintptr_t m, unsigned limit)
{ {
for (unsigned i = 0; i < 16; ++i) { if (limit) {
if ((m >> i) & 1) { for (unsigned i = 0; i < 16; ++i) {
fprintf(stderr, "1"); if ((m >> i) & 1) {
} else { fprintf(stderr, "1");
fprintf(stderr, "_"); } else {
fprintf(stderr, "_");
}
} }
} }
} }
@ -3714,7 +3718,7 @@ calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
if (DebugFrameMaps) { if (DebugFrameMaps) {
fprintf(stderr, " roots at ip %3d: ", ip); fprintf(stderr, " roots at ip %3d: ", ip);
printSet(*roots); printSet(*roots, mapSize);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
@ -3741,7 +3745,7 @@ calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
if (DebugFrameMaps) { if (DebugFrameMaps) {
fprintf(stderr, "table roots at ip %3d: ", ip); fprintf(stderr, "table roots at ip %3d: ", ip);
printSet(*tableRoots); printSet(*tableRoots, mapSize);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
} else { } else {
@ -3775,7 +3779,7 @@ calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
TraceElement* te; context->eventLog.get(eventIndex, &te, BytesPerWord); TraceElement* te; context->eventLog.get(eventIndex, &te, BytesPerWord);
if (DebugFrameMaps) { if (DebugFrameMaps) {
fprintf(stderr, "trace roots at ip %3d: ", ip); fprintf(stderr, "trace roots at ip %3d: ", ip);
printSet(*roots); printSet(*roots, mapSize);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
memcpy(te->map, roots, mapSize * BytesPerWord); memcpy(te->map, roots, mapSize * BytesPerWord);
@ -3935,7 +3939,7 @@ finish(MyThread* t, Context* context)
if (DebugFrameMaps) { if (DebugFrameMaps) {
fprintf(stderr, " orig roots at ip %p: ", reinterpret_cast<void*> fprintf(stderr, " orig roots at ip %p: ", reinterpret_cast<void*>
(p->address->value())); (p->address->value()));
printSet(p->map[0]); printSet(p->map[0], frameMapSizeInWords(t, context->method));
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fprintf(stderr, "final roots at ip %p: ", reinterpret_cast<void*> fprintf(stderr, "final roots at ip %p: ", reinterpret_cast<void*>