fix CallEvent::popIndex calculation

This commit is contained in:
Joel Dice 2009-04-26 21:59:22 -06:00
parent 50529969f9
commit fd99691b00

View File

@ -2247,11 +2247,14 @@ clean(Context* c, Value* v, unsigned popIndex)
(c, static_cast<MemorySite*>(s)->offset) (c, static_cast<MemorySite*>(s)->offset)
>= popIndex)) >= popIndex))
{ {
if (false) { if (false and
s->match(c, SiteMask(1 << MemoryOperand, 0, AnyFrameIndex)))
{
char buffer[256]; s->toString(c, buffer, 256); char buffer[256]; s->toString(c, buffer, 256);
fprintf(stderr, "remove %s from %p at %d pop index %d\n", fprintf(stderr, "remove %s from %p at %d pop offset 0x%x\n",
buffer, v, offsetToFrameIndex buffer, v, offsetToFrameIndex
(c, static_cast<MemorySite*>(s)->offset), popIndex); (c, static_cast<MemorySite*>(s)->offset),
frameIndexToOffset(c, popIndex));
} }
it.remove(c); it.remove(c);
} }
@ -2425,25 +2428,20 @@ class CallEvent: public Event {
} }
-- footprint; -- footprint;
if (footprint == 0 and (flags & Compiler::TailJump) == 0) {
stackArgumentIndex = s->index + c->localFootprint;
}
++ frameIndex; ++ frameIndex;
} }
if ((flags & Compiler::TailJump) == 0) { if ((flags & Compiler::TailJump) == 0) {
if (stackArgumentFootprint == 0) { stackArgumentIndex = c->localFootprint;
stackArgumentIndex = (stackBefore ? stackBefore->index + 1 : 0) if (stackBefore) {
+ c->localFootprint; stackArgumentIndex += stackBefore->index + 1 - stackArgumentFootprint;
} }
popIndex popIndex
= c->alignedFrameSize = c->alignedFrameSize
+ c->parameterFootprint
- c->arch->frameFooterSize() - c->arch->frameFooterSize()
- (stackBefore ? stackBefore->index + 1 - stackArgumentFootprint : 0) - stackArgumentIndex;
- c->localFootprint;
assert(c, static_cast<int>(popIndex) >= 0); assert(c, static_cast<int>(popIndex) >= 0);