From c8d5c1faededa03511aa49d1ff7600b9a5ff0cca Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 26 Oct 2009 17:59:20 -0600 Subject: [PATCH] visit all frame locations in resolveOriginalSites Previously, we only visited frame locations containing values, but this invited the possibility of reusing the same site for two locations in some cases. --- src/compile.cpp | 8 ++++++++ src/compiler.cpp | 29 +++++++++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/compile.cpp b/src/compile.cpp index f2db4af7b3..e10fc355a2 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -5715,6 +5715,14 @@ compileMethod2(MyThread* t, void* ip) t->trace->targetMethod = 0; } + if (false) { + compile(t, codeAllocator(t), 0, resolveMethod + (t, t->m->loader, + "org/eclipse/swt/widgets/TableItem", + "getBounds", + "(IIZZZZJ)Lorg/eclipse/swt/internal/win32/RECT;")); + } + if (UNLIKELY(t->exception)) { return 0; } else { diff --git a/src/compiler.cpp b/src/compiler.cpp index 2e76854f83..0d91fb714d 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -757,14 +757,18 @@ class FrameIterator { const unsigned localIndex; }; - FrameIterator(Context* c, Stack* stack, Local* locals): - stack(stack), locals(locals), localIndex(c->localFootprint - 1) + FrameIterator(Context* c, Stack* stack, Local* locals, + bool includeEmpty = false): + stack(stack), locals(locals), localIndex(c->localFootprint - 1), + includeEmpty(includeEmpty) { } bool hasMore() { - while (stack and stack->value == 0) stack = stack->next; + if (not includeEmpty) { + while (stack and stack->value == 0) stack = stack->next; - while (localIndex >= 0 and locals[localIndex].value == 0) -- localIndex; + while (localIndex >= 0 and locals[localIndex].value == 0) -- localIndex; + } return stack != 0 or localIndex >= 0; } @@ -789,6 +793,7 @@ class FrameIterator { Stack* stack; Local* locals; int localIndex; + bool includeEmpty; }; int @@ -1689,7 +1694,8 @@ class RegisterSite: public Site { if (number != NoRegister) { return vm::snprintf(buffer, bufferSize, "%p register %d", this, number); } else { - return vm::snprintf(buffer, bufferSize, "%p register unacquired", this); + return vm::snprintf(buffer, bufferSize, + "%p register unacquired (mask %d)", this, mask); } } @@ -5000,10 +5006,12 @@ resolveOriginalSites(Context* c, Event* e, SiteRecordList* frozen, Site** sites) { bool complete = true; - for (FrameIterator it(c, e->stackAfter, e->localsAfter); it.hasMore();) { + for (FrameIterator it(c, e->stackAfter, e->localsAfter, true); + it.hasMore();) + { FrameIterator::Element el = it.next(c); Value* v = el.value; - Read* r = live(v); + Read* r = v ? live(v) : 0; Site* s = sites[el.localIndex]; if (r) { @@ -5027,9 +5035,10 @@ resolveOriginalSites(Context* c, Event* e, SiteRecordList* frozen, buffer, v, el.localIndex, frameIndex(c, &el)); } - addSite(c, v, s); - removeSite(c, v, s); - freeze(c, frozen, s, v); + Value dummy(0, 0, ValueGeneral); + addSite(c, &dummy, s); + removeSite(c, &dummy, s); + freeze(c, frozen, s, 0); } }