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.
This commit is contained in:
Joel Dice 2009-10-26 17:59:20 -06:00
parent 3b4be3decd
commit c8d5c1faed
2 changed files with 27 additions and 10 deletions

View File

@ -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 {

View File

@ -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);
}
}