summaryrefslogtreecommitdiff
path: root/compiler/codeGen/StgCmmHeap.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-07-06 11:27:07 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-07-06 16:49:58 +0100
commit147b54230624617ef7c3056b627053ce9a0a80e9 (patch)
tree36b40473d7612556e83f233f459520892e50c7bb /compiler/codeGen/StgCmmHeap.hs
parent7d7c284bbc7204ee430e0717e8883e0d38035bb8 (diff)
downloadhaskell-147b54230624617ef7c3056b627053ce9a0a80e9.tar.gz
Generate slightly less crap to be cleaned up later
Diffstat (limited to 'compiler/codeGen/StgCmmHeap.hs')
-rw-r--r--compiler/codeGen/StgCmmHeap.hs17
1 files changed, 7 insertions, 10 deletions
diff --git a/compiler/codeGen/StgCmmHeap.hs b/compiler/codeGen/StgCmmHeap.hs
index 611304b5e0..bc61cf5b97 100644
--- a/compiler/codeGen/StgCmmHeap.hs
+++ b/compiler/codeGen/StgCmmHeap.hs
@@ -45,6 +45,8 @@ import FastString( mkFastString, fsLit )
import Constants
import Util
+import Control.Monad (when)
+
-----------------------------------------------------------
-- Initialise dynamic heap objects
-----------------------------------------------------------
@@ -491,20 +493,15 @@ do_checks :: Bool -- Should we check the stack?
-> FCode ()
do_checks checkStack alloc do_gc = do
gc_id <- newLabelC
- hp_check <- if alloc == 0
- then return mkNop
- else do
- ifthen <- mkCmmIfThen hp_oflo (alloc_n <*> mkBranch gc_id)
- return (mkAssign hpReg bump_hp <*> ifthen)
- if checkStack
- then emit =<< mkCmmIfThenElse sp_oflo (mkBranch gc_id) hp_check
- else emit hp_check
+ when checkStack $
+ emit =<< mkCmmIfGoto sp_oflo gc_id
- emit $ mkComment (mkFastString "outOfLine should follow:")
+ when (alloc /= 0) $ do
+ emitAssign hpReg bump_hp
+ emit =<< mkCmmIfThen hp_oflo (alloc_n <*> mkBranch gc_id)
emitOutOfLine gc_id $
- mkComment (mkFastString "outOfLine here") <*>
do_gc -- this is expected to jump back somewhere
-- Test for stack pointer exhaustion, then