summaryrefslogtreecommitdiff
path: root/ghc/compiler/codeGen/CgStackery.lhs
diff options
context:
space:
mode:
authorsewardj <unknown>2001-09-12 15:52:40 +0000
committersewardj <unknown>2001-09-12 15:52:40 +0000
commit7a846c96fdd5f336fa39c12112dc60dd2d3a1e95 (patch)
tree4ed71aa7ff85ae39437c6931a6f2928dc7b5d7c7 /ghc/compiler/codeGen/CgStackery.lhs
parent2db150e82af6cb9802006227cffb8414d99261f3 (diff)
downloadhaskell-7a846c96fdd5f336fa39c12112dc60dd2d3a1e95.tar.gz
[project @ 2001-09-12 15:52:40 by sewardj]
merge (ghc-5-02-branch --> HEAD): Bugfix: there was an implicit assumption that the list of slots passed to freeStackSlots was already sorted, whereas in fact this wasn't the case for at least one call. Now we explicitly sort the list in freeStackSlots, removing the hidden assumption. The symptoms of this bug include crashes (perhaps the "AsmCodeGen" crash), and a tendency to grow the stack a lot when let-no-escapes are involved (because the bug caused fragmentation of the stack free list, so we weren't re-using free slots properly). 1.17.2.1 +3 -2 fptools/ghc/compiler/codeGen/CgStackery.lhs ASSERT that the list of stack slots we calculate in buildLivenessMask is sorted, because we rely on that property later. 1.38.2.1 +5 -6 fptools/ghc/compiler/codeGen/CgBindery.lhs
Diffstat (limited to 'ghc/compiler/codeGen/CgStackery.lhs')
-rw-r--r--ghc/compiler/codeGen/CgStackery.lhs5
1 files changed, 3 insertions, 2 deletions
diff --git a/ghc/compiler/codeGen/CgStackery.lhs b/ghc/compiler/codeGen/CgStackery.lhs
index 3a2598ef2b..896cfc7e98 100644
--- a/ghc/compiler/codeGen/CgStackery.lhs
+++ b/ghc/compiler/codeGen/CgStackery.lhs
@@ -1,7 +1,7 @@
%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
-% $Id: CgStackery.lhs,v 1.18 2001/08/31 12:39:06 rje Exp $
+% $Id: CgStackery.lhs,v 1.19 2001/09/12 15:52:40 sewardj Exp $
%
\section[CgStackery]{Stack management functions}
@@ -30,6 +30,7 @@ import Panic ( panic )
import Constants ( uF_SIZE, sCC_UF_SIZE, gRAN_UF_SIZE,
sEQ_FRAME_SIZE, sCC_SEQ_FRAME_SIZE, gRAN_SEQ_FRAME_SIZE )
+import Util ( sortLt )
import IOExts ( trace )
\end{code}
@@ -242,7 +243,7 @@ Explicitly free some stack space.
addFreeStackSlots :: [VirtualSpOffset] -> Slot -> Code
addFreeStackSlots extra_free slot = do
((vsp, free, real, hw),heap_usage) <- getUsage
- let all_free = addFreeSlots free (zip extra_free (repeat slot))
+ let all_free = addFreeSlots free (zip (sortLt (<) extra_free) (repeat slot))
let (new_vsp, new_free) = trim vsp all_free
let new_usage = ((new_vsp, new_free, real, hw), heap_usage)
setUsage new_usage