fix code ordering bug in compile() which caused us to calculate the stack map incorrectly; logging tweak

This commit is contained in:
Joel Dice 2008-01-07 15:04:53 -07:00
parent 259dd643e0
commit 2cda000725

View File

@ -3385,11 +3385,12 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip)
void void
logCompile(const void* code, unsigned size, const char* class_, logCompile(const void* code, unsigned size, const char* class_,
const char* name) const char* name, const char* spec)
{ {
if (Verbose) { if (Verbose) {
fprintf(stderr, "%s.%s from %p to %p\n", fprintf(stderr, "%s.%s%s from %p to %p\n",
class_, name, code, static_cast<const uint8_t*>(code) + size); class_, name, spec, code,
static_cast<const uint8_t*>(code) + size);
} }
} }
@ -3698,7 +3699,9 @@ finish(MyThread* t, Context* context, const char* name)
reinterpret_cast<const char*> reinterpret_cast<const char*>
(&byteArrayBody(t, className(t, methodClass(t, context->method)), 0)), (&byteArrayBody(t, className(t, methodClass(t, context->method)), 0)),
reinterpret_cast<const char*> reinterpret_cast<const char*>
(&byteArrayBody(t, methodName(t, context->method), 0))); (&byteArrayBody(t, methodName(t, context->method), 0)),
reinterpret_cast<const char*>
(&byteArrayBody(t, methodSpec(t, context->method), 0)));
} }
// for debugging: // for debugging:
@ -3716,7 +3719,7 @@ finish(MyThread* t, Context* context, const char* name)
} }
} else { } else {
if (Verbose) { if (Verbose) {
logCompile(start, c->codeSize(), 0, name); logCompile(start, c->codeSize(), 0, name, 0);
} }
} }
@ -3740,8 +3743,6 @@ compile(MyThread* t, Context* context)
uintptr_t stackMap[stackMapSizeInWords(t, context->method)]; uintptr_t stackMap[stackMapSizeInWords(t, context->method)];
Frame frame(context, stackMap); Frame frame(context, stackMap);
handleEntrance(t, &frame);
unsigned index = 0; unsigned index = 0;
if ((methodFlags(t, context->method) & ACC_STATIC) == 0) { if ((methodFlags(t, context->method) & ACC_STATIC) == 0) {
frame.mark(index++); frame.mark(index++);
@ -3769,6 +3770,8 @@ compile(MyThread* t, Context* context)
} }
} }
handleEntrance(t, &frame);
compile(t, &frame, 0); compile(t, &frame, 0);
if (UNLIKELY(t->exception)) return 0; if (UNLIKELY(t->exception)) return 0;
@ -4628,7 +4631,7 @@ processor(MyThread* t)
c->writeTo(p->indirectCaller); c->writeTo(p->indirectCaller);
if (Verbose) { if (Verbose) {
logCompile(p->indirectCaller, c->codeSize(), 0, "indirect caller"); logCompile(p->indirectCaller, c->codeSize(), 0, "indirect caller", 0);
} }
} }