diff --git a/src/avian/classpath-common.h b/src/avian/classpath-common.h index b877ae2425..9f625cbd3a 100644 --- a/src/avian/classpath-common.h +++ b/src/avian/classpath-common.h @@ -594,9 +594,13 @@ object invoke(Thread* t, GcMethod* method, object instance, object args) object arg = objectArrayBody(t, args, i++); if ((arg == 0 and (not objectType)) or (arg and (not instanceOf(t, type, arg)))) { - // fprintf(stderr, "%s is not a %s\n", arg ? &byteArrayBody(t, - // className(t, objectClass(t, arg)), 0) : reinterpret_cast(""), &byteArrayBody(t, className(t, type), 0)); + if (false) { + fprintf(stderr, + "%s is not a %s\n", + arg ? objectClass(t, arg)->name()->body().begin() + : reinterpret_cast(""), + type->name()->body().begin()); + } throwNew(t, GcIllegalArgumentException::Type); } @@ -661,12 +665,17 @@ void intercept(Thread* t, } else { // If we can't find the method, just ignore it, since ProGuard may // have stripped it out as unused. Otherwise, the code below can - // be uncommented for debugging purposes. + // be enabled for debugging purposes. - // fprintf(stderr, "unable to find %s%s in %s\n", - // name, spec, &byteArrayBody(t, c->name(), 0)); + if (false) { + fprintf(stderr, + "unable to find %s%s in %s\n", + name, + spec, + c->name()->body().begin()); - // abort(t); + abort(t); + } } } diff --git a/src/codegen/compiler.cpp b/src/codegen/compiler.cpp index edf2e50218..3a72d36176 100644 --- a/src/codegen/compiler.cpp +++ b/src/codegen/compiler.cpp @@ -1354,11 +1354,14 @@ unsigned frameFootprint(Context* c, Stack* s) void visit(Context* c, Link* link) { - // fprintf(stderr, "visit link from %d to %d fork %p junction %p\n", - // link->predecessor->logicalInstruction->index, - // link->successor->logicalInstruction->index, - // link->forkState, - // link->junctionState); + if (false) { + fprintf(stderr, + "visit link from %d to %d fork %p junction %p\n", + link->predecessor->logicalInstruction->index, + link->successor->logicalInstruction->index, + link->forkState, + link->junctionState); + } ForkState* forkState = link->forkState; if (forkState) { @@ -1366,8 +1369,9 @@ void visit(Context* c, Link* link) ForkElement* p = forkState->elements + i; Value* v = p->value; v->reads = p->read->nextTarget(); - // fprintf(stderr, "next read %p for %p from %p\n", v->reads, v, - // p->read); + if (false) { + fprintf(stderr, "next read %p for %p from %p\n", v->reads, v, p->read); + } if (not live(c, v)) { v->clearSites(c); } @@ -1865,9 +1869,16 @@ void restore(Context* c, Event* e, Snapshot* snapshots) } } - // char buffer[256]; sitesToString(c, s->sites, buffer, 256); - // fprintf(stderr, "restore %p buddy %p sites %s live %p\n", - // s->value, s->value->buddy, buffer, live(c, s->value)); + if (false) { + char buffer[256]; + sitesToString(c, s->sites, buffer, 256); + fprintf(stderr, + "restore %p buddy %p sites %s live %p\n", + s->value, + s->value->buddy, + buffer, + live(c, s->value)); + } } } diff --git a/src/codegen/compiler/event.cpp b/src/codegen/compiler/event.cpp index b4433da9cf..5bd721815a 100644 --- a/src/codegen/compiler/event.cpp +++ b/src/codegen/compiler/event.cpp @@ -148,9 +148,9 @@ void Event::addRead(Context* c, Value* v, Read* r) } if (v->lastRead) { - // if (DebugReads) { - // fprintf(stderr, "append %p to %p for %p\n", r, v->lastRead, v); - // } + if (DebugReads) { + fprintf(stderr, "append %p to %p for %p\n", r, v->lastRead, v); + } v->lastRead->append(c, r); } else { @@ -298,9 +298,9 @@ Value* slicePushWord(Context* c, assertT(c, slice.count < slice.capacity); slice.push(v); - // if (DebugFrame) { - // fprintf(stderr, "push %p\n", v); - // } + if (false) { + fprintf(stderr, "push %p\n", v); + } if (v) { v->home = frameIndex(c, index + stackBase + c->localFootprint); @@ -1102,13 +1102,19 @@ class CombineEvent : public Event { c, firstValue->source->type(c) == firstValue->nextWord->source->type(c)); - // if (secondValue->source->type(c) != - // secondValue->nextWord->source->type(c)) { - // fprintf(stderr, "%p %p %d : %p %p %d\n", - // secondValue, secondValue->source, secondValue->source->type(c), - // secondValue->nextWord, secondValue->nextWord->source, - // secondValue->nextWord->source->type(c)); - // } + if (false) { + if (secondValue->source->type(c) + != secondValue->nextWord->source->type(c)) { + fprintf(stderr, + "%p %p %d : %p %p %d\n", + secondValue, + secondValue->source, + secondValue->source->type(c), + secondValue->nextWord, + secondValue->nextWord->source, + secondValue->nextWord->source->type(c)); + } + } assertT( c, @@ -1149,10 +1155,16 @@ class CombineEvent : public Event { resultHighMask) : low); - // fprintf(stderr, "combine %p:%p and %p:%p into %p:%p\n", - // firstValue, firstValue->nextWord, - // secondValue, secondValue->nextWord, - // resultValue, resultValue->nextWord); + if (false) { + fprintf(stderr, + "combine %p:%p and %p:%p into %p:%p\n", + firstValue, + firstValue->nextWord, + secondValue, + secondValue->nextWord, + resultValue, + resultValue->nextWord); + } apply(c, op, diff --git a/src/codegen/compiler/read.cpp b/src/codegen/compiler/read.cpp index 3eb6564f37..0c7d09fd76 100644 --- a/src/codegen/compiler/read.cpp +++ b/src/codegen/compiler/read.cpp @@ -123,7 +123,9 @@ void MultiRead::append(Context* c, Read* r) } lastRead = cell; - // fprintf(stderr, "append %p to %p for %p\n", r, lastTarget, this); + if (false) { + fprintf(stderr, "append %p to %p for %p\n", r, lastTarget, this); + } lastTarget->item = r; } @@ -137,7 +139,9 @@ void MultiRead::allocateTarget(Context* c) { List* cell = cons(c, 0, 0); - // fprintf(stderr, "allocate target for %p: %p\n", this, cell); + if (false) { + fprintf(stderr, "allocate target for %p: %p\n", this, cell); + } if (lastTarget) { lastTarget->next = cell; @@ -149,7 +153,9 @@ void MultiRead::allocateTarget(Context* c) Read* MultiRead::nextTarget() { - // fprintf(stderr, "next target for %p: %p\n", this, firstTarget); + if (false) { + fprintf(stderr, "next target for %p: %p\n", this, firstTarget); + } Read* r = firstTarget->item; firstTarget = firstTarget->next; diff --git a/src/codegen/target/arm/assembler.cpp b/src/codegen/target/arm/assembler.cpp index db396842a9..9f9b0dcfce 100644 --- a/src/codegen/target/arm/assembler.cpp +++ b/src/codegen/target/arm/assembler.cpp @@ -989,8 +989,12 @@ class MyAssembler : public Assembler { static_cast(e->address), e->callOffset ? dst + e->callOffset->value() + 8 : 0); } - // fprintf(stderr, "constant %p at %p\n", - // reinterpret_cast(e->constant->value()), e->address); + if (false) { + fprintf(stderr, + "constant %p at %p\n", + reinterpret_cast(e->constant->value()), + e->address); + } } } diff --git a/src/compile.cpp b/src/compile.cpp index 99733fb4b6..7a546feb3a 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -450,20 +450,18 @@ void nextFrame(MyThread* t, methodIsMostRecent = false; } - // fprintf(stderr, "nextFrame %s.%s%s target %s.%s%s ip %p sp %p\n", - // method->class_()->name()->body().begin(), - // method->name()->body().begin(), - // method->spec()->body().begin(), - // target - // ? &byteArrayBody(t, target->class_()->name(), 0) - // : 0, - // target - // ? &byteArrayBody(t, target->name(), 0) - // : 0, - // target - // ? &byteArrayBody(t, target->spec(), 0) - // : 0, - // *ip, *sp); + if (false) { + fprintf(stderr, + "nextFrame %s.%s%s target %s.%s%s ip %p sp %p\n", + method->class_()->name()->body().begin(), + method->name()->body().begin(), + method->spec()->body().begin(), + target ? target->class_()->name()->body().begin() : 0, + target ? target->name()->body().begin() : 0, + target ? target->spec()->body().begin() : 0, + *ip, + *sp); + } t->arch->nextFrame(reinterpret_cast(start), code->compiledSize(), @@ -474,7 +472,9 @@ void nextFrame(MyThread* t, ip, sp); - // fprintf(stderr, "next frame ip %p sp %p\n", *ip, *sp); + if (false) { + fprintf(stderr, "next frame ip %p sp %p\n", *ip, *sp); + } } void* getIp(MyThread* t, void* ip, void* stack) @@ -556,7 +556,9 @@ class MyStackWalker : public Processor::StackWalker { bool valid() { while (true) { - // fprintf(stderr, "state: %d\n", state); + if (false) { + fprintf(stderr, "state: %d\n", state); + } switch (state) { case Start: if (trace and trace->nativeMethod) { @@ -638,9 +640,12 @@ class MyStackWalker : public Processor::StackWalker { virtual GcMethod* method() { - // fprintf(stderr, "method %s.%s\n", &byteArrayBody - // (t, className(t, methodClass(t, method_)), 0), - // &byteArrayBody(t, methodName(t, method_), 0)); + if (false) { + fprintf(stderr, + "method %s.%s\n", + method_->class_()->name()->body().begin(), + method_->name()->body().begin()); + } return method_; } @@ -3924,8 +3929,6 @@ loop: c->threadRegister()); } - // fprintf(stderr, "ip: %d map: %ld\n", ip, *(frame->map)); - if (DebugInstructions) { unsigned startingIp = ip; fprintf(stderr, " stack: ["); @@ -6991,10 +6994,13 @@ void compile(MyThread* t, Context* context) { avian::codegen::Compiler* c = context->compiler; - // fprintf(stderr, "compiling %s.%s%s\n", - // context->method->class_()->name()->body().begin(), - // context->method->name()->body().begin(), - // context->method->spec()->body().begin()); + if (false) { + fprintf(stderr, + "compiling %s.%s%s\n", + context->method->class_()->name()->body().begin(), + context->method->name()->body().begin(), + context->method->spec()->body().begin()); + } unsigned footprint = context->method->parameterFootprint(); unsigned locals = localSize(t, context->method); @@ -9527,8 +9533,13 @@ void fixupHeap(MyThread* t UNUSED, if (number) { *p = reinterpret_cast(heap + (number - 1)) | mark; - // fprintf(stderr, "fixup %d: %d 0x%x\n", index, - // static_cast(number), static_cast(*p)); + if (false) { + fprintf(stderr, + "fixup %d: %d 0x%x\n", + index, + static_cast(number), + static_cast(*p)); + } } else { *p = mark; } @@ -9675,14 +9686,19 @@ void boot(MyThread* t, BootImage* image, uint8_t* code) t->heapImage = p->heapImage = heap; - // fprintf(stderr, "heap from %p to %p\n", - // heap, heap + ceilingDivide(image->heapSize, BytesPerWord)); + if (false) { + fprintf(stderr, + "heap from %p to %p\n", + heap, + heap + ceilingDivide(image->heapSize, BytesPerWord)); + } t->codeImage = p->codeImage = code; p->codeImageSize = image->codeSize; - // fprintf(stderr, "code from %p to %p\n", - // code, code + image->codeSize); + if (false) { + fprintf(stderr, "code from %p to %p\n", code, code + image->codeSize); + } if (not image->initialized) { fixupHeap(t, heapMap, heapMapSizeInWords, heap); diff --git a/src/jnienv.cpp b/src/jnienv.cpp index 58089d1e62..1f067b0268 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -3088,9 +3088,14 @@ uint64_t registerNatives(Thread* t, uintptr_t* arguments) // case, but that would prevent using a code shrinker like // ProGuard effectively. Instead, we just ignore it. - // fprintf(stderr, "not found: %s.%s%s\n", &byteArrayBody(t, - // className(t, (*c)->vmClass()), 0), methods[i].name, sig); - // abort(t); + if (false) { + fprintf(stderr, + "not found: %s.%s%s\n", + (*c)->vmClass()->name()->body().begin(), + methods[i].name, + sig); + abort(t); + } } else { registerNative(t, method, methods[i].function); } diff --git a/src/machine.cpp b/src/machine.cpp index 82d95a6629..a9af32e917 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -3536,16 +3536,18 @@ object findInTable(Thread* t, } } - // fprintf(stderr, "%s %s not in\n", - // name->body().begin(), - // spec->body().begin(); + if (false) { + fprintf( + stderr, "%s %s not in\n", name->body().begin(), spec->body().begin()); - // for (unsigned i = 0; i < arrayLength(t, table); ++i) { - // object o = arrayBody(t, table, i); - // fprintf(stderr, "\t%s %s\n", - // &byteArrayBody(t, getName(t, o), 0), - // &byteArrayBody(t, getSpec(t, o), 0)); - // } + for (unsigned i = 0; i < table->length(); ++i) { + object o = table->body()[i]; + fprintf(stderr, + "\t%s %s\n", + getName(t, o)->body().begin(), + getSpec(t, o)->body().begin()); + } + } } return 0; diff --git a/src/tools/bootimage-generator/main.cpp b/src/tools/bootimage-generator/main.cpp index 70ce2e5459..bdb4102c00 100644 --- a/src/tools/bootimage-generator/main.cpp +++ b/src/tools/bootimage-generator/main.cpp @@ -354,7 +354,9 @@ GcTriple* makeCodeImage(Thread* t, if (endsWith(".class", name, nameSize) and (className == 0 or strncmp(name, className, nameSize - 6) == 0)) { - // fprintf(stderr, "pass 1 %.*s\n", nameSize - 6, name); + if (false) { + fprintf(stderr, "pass 1 %.*s\n", nameSize - 6, name); + } GcClass* c = resolveSystemClass(t, roots(t)->bootLoader(), @@ -690,7 +692,9 @@ GcTriple* makeCodeImage(Thread* t, if (endsWith(".class", name, nameSize) and (className == 0 or strncmp(name, className, nameSize - 6) == 0)) { - // fprintf(stderr, "pass 2 %.*s\n", nameSize - 6, name); + if (false) { + fprintf(stderr, "pass 2 %.*s\n", nameSize - 6, name); + } GcClass* c = 0; PROTECT(t, c);