From 58a9718d824533fc27178f2a67c50117a1928af4 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 25 Nov 2008 16:00:40 -0700 Subject: [PATCH] clean stack sites more aggressively after function calls to avoid GC bugs --- src/compiler.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/compiler.cpp b/src/compiler.cpp index a3061720d6..620bd0fe44 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -2375,10 +2375,6 @@ class CallEvent: public Event { target = read(c, footprintSizeInBytes(s->footprint), 1 << MemoryOperand, 0, frameIndex); frameIndex += s->footprint; - - if (stackArgumentFootprint == 0) { - popIndex = frameIndex; - } } addRead(c, this, s->value, target); index += s->footprint; @@ -2412,18 +2408,18 @@ class CallEvent: public Event { (c, footprintSizeInBytes(s->footprint), 1 << MemoryOperand, 0, frameIndex)); } else { - unsigned index = ::frameIndex + unsigned logicalIndex = ::frameIndex (c, s->index + c->localFootprint, s->footprint); if (DebugReads) { fprintf(stderr, "stack save read %p of footprint %d at %d of %d\n", - s->value, s->footprint, index, + s->value, s->footprint, logicalIndex, c->alignedFrameSize + c->parameterFootprint); } addRead(c, this, s->value, read (c, footprintSizeInBytes(s->footprint), 1 << MemoryOperand, - 0, index)); + 0, logicalIndex)); } footprint -= s->footprint; @@ -2436,12 +2432,19 @@ class CallEvent: public Event { padding = logicalIndex - frameIndex; padIndex = s->index + c->localFootprint; - popIndex = frameIndex + s->footprint; } frameIndex += s->footprint; } + popIndex = ::frameIndex + (c, (stackBefore + ? stackBefore->index + + stackBefore->footprint + - stackArgumentFootprint + : 0) + + c->localFootprint, 0); + saveLocals(c, this); }