Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/2f8ef8f701954dc5f145dbabe11f80ba2bed45db >--------------------------------------------------------------- commit 2f8ef8f701954dc5f145dbabe11f80ba2bed45db Author: David Terei <[email protected]> Date: Sat Jun 25 11:33:14 2011 -0700 Speed improvement to LLVM Mangler for large sections. Patch by Peter Wortmann! >--------------------------------------------------------------- compiler/llvmGen/LlvmMangler.hs | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs index 591ef81..4f61a93 100644 --- a/compiler/llvmGen/LlvmMangler.hs +++ b/compiler/llvmGen/LlvmMangler.hs @@ -71,7 +71,7 @@ llvmFixupAsm f1 f2 = do -} fixTables :: Handle -> Handle -> I.IntMap B.ByteString -> IO () fixTables r w m = do - f <- getFun r B.empty + f <- getFun r if B.null f then return () else let fun = fixupStack f B.empty @@ -92,13 +92,14 @@ fixTables r w m = do in mapM_ (B.hPut w) bs >> fixTables r w m' -- | Read in the next function/data defenition -getFun :: Handle -> B.ByteString -> IO B.ByteString -getFun r f = do - l <- (try (B.hGetLine r))::IO (Either IOError B.ByteString) - case l of - Right l' | B.null l' -> return f - | otherwise -> getFun r (f `B.append` newLine `B.append` l') - Left _ -> return B.empty +getFun :: Handle -> IO B.ByteString +getFun r = go [] >>= return . B.intercalate newLine + where go ls = do + l <- (try (B.hGetLine r))::IO (Either IOError B.ByteString) + case l of + Right l' | B.null l' -> (return B.empty : reverse ls) + | otherwise -> go (l':ls) + Left _ -> return [] {-| Mac OS X requires that the stack be 16 byte aligned when making a function _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
