Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/48bb69ac4d5de847774657042d6b935d49445cb0 >--------------------------------------------------------------- commit 48bb69ac4d5de847774657042d6b935d49445cb0 Author: Ian Lynagh <i...@well-typed.com> Date: Tue Dec 11 17:04:06 2012 +0000 Small refactoring: Use more idiomatic strictness forcing in AsmCodeGen >--------------------------------------------------------------- compiler/nativeGen/AsmCodeGen.lhs | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs index 9917619..38cd7b7 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. _______________________________________________ Cvs-ghc mailing list Cvs-ghc@haskell.org http://www.haskell.org/mailman/listinfo/cvs-ghc