summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-12-11 17:04:06 +0000
committerIan Lynagh <ian@well-typed.com>2012-12-11 17:37:46 +0000
commit48bb69ac4d5de847774657042d6b935d49445cb0 (patch)
tree08a236780479c5733248c4c77ab7466c5d16e733 /compiler/nativeGen
parent497cb612ec598aa925fc33042ca0e49e59066af1 (diff)
downloadhaskell-48bb69ac4d5de847774657042d6b935d49445cb0.tar.gz
Small refactoring: Use more idiomatic strictness forcing in AsmCodeGen
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/AsmCodeGen.lhs12
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs
index 99176199e9..38cd7b748c 100644
--- a/compiler/nativeGen/AsmCodeGen.lhs
+++ b/compiler/nativeGen/AsmCodeGen.lhs
@@ -80,6 +80,7 @@ import qualified Stream
import Data.List
import Data.Maybe
+import Control.Exception
import Control.Monad
import System.IO
@@ -363,19 +364,16 @@ cmmNativeGens dflags ncgImpl h us (cmm : cmms) impAcc profAcc count
$ withPprStyleDoc dflags (mkCodeStyle AsmStyle)
$ vcat $ map (pprNatCmmDecl ncgImpl) native
- -- carefully evaluate this strictly. Binding it with 'let'
- -- and then using 'seq' doesn't work, because the let
- -- apparently gets inlined first.
- lsPprNative <- return $!
+ let !lsPprNative =
if dopt Opt_D_dump_asm dflags
|| dopt Opt_D_dump_asm_stats dflags
then native
else []
- count' <- return $! count + 1;
+ let !count' = count + 1
-- force evaulation all this stuff to avoid space leaks
- {-# SCC "seqString" #-} seqString (showSDoc dflags $ vcat $ map ppr imports) `seq` return ()
+ {-# SCC "seqString" #-} evaluate $ seqString (showSDoc dflags $ vcat $ map ppr imports)
cmmNativeGens dflags ncgImpl
h us' cmms
@@ -384,7 +382,7 @@ cmmNativeGens dflags ncgImpl h us (cmm : cmms) impAcc profAcc count
count'
where seqString [] = ()
- seqString (x:xs) = x `seq` seqString xs `seq` ()
+ seqString (x:xs) = x `seq` seqString xs
-- | Complete native code generation phase for a single top-level chunk of Cmm.