projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Need to pass gcc -m64 on amd64 OSX
[ghc-hetmet.git]
/
compiler
/
utils
/
Pretty.lhs
diff --git
a/compiler/utils/Pretty.lhs
b/compiler/utils/Pretty.lhs
index
7aec715
..
47d4b1e
100644
(file)
--- a/
compiler/utils/Pretty.lhs
+++ b/
compiler/utils/Pretty.lhs
@@
-176,7
+176,8
@@
module Pretty (
hang, punctuate,
-- renderStyle, -- Haskell 1.3 only
hang, punctuate,
-- renderStyle, -- Haskell 1.3 only
- render, fullRender, printDoc, showDocWith
+ render, fullRender, printDoc, showDocWith,
+ bufLeftRender -- performance hack
) where
import BufWrite
) where
import BufWrite
@@
-614,7
+615,7
@@
aboveNest (Nest k1 p) g k q = nest_ k1 (aboveNest p g (k -# k1) q)
aboveNest (NilAbove p) g k q = nilAbove_ (aboveNest p g k q)
aboveNest (TextBeside s sl p) g k q = textBeside_ s sl rest
where
aboveNest (NilAbove p) g k q = nilAbove_ (aboveNest p g k q)
aboveNest (TextBeside s sl p) g k q = textBeside_ s sl rest
where
- k1 = k -# sl
+ !k1 = k -# sl
rest = case p of
Empty -> nilAboveNest g k1 q
_ -> aboveNest p g k1 q
rest = case p of
Empty -> nilAboveNest g k1 q
_ -> aboveNest p g k1 q
@@
-774,8
+775,8
@@
fillNB g Empty k (y:ys) = nilBeside g (fill1 g (oneLiner (reduceDoc y)) k1 ys
`mkUnion`
nilAboveNest False k (fill g (y:ys))
where
`mkUnion`
nilAboveNest False k (fill g (y:ys))
where
- k1 | g = k -# _ILIT(1)
- | otherwise = k
+ !k1 | g = k -# _ILIT(1)
+ | otherwise = k
fillNB g p k ys = fill1 g p k ys
\end{code}
fillNB g p k ys = fill1 g p k ys
\end{code}
@@
-796,7
+797,7
@@
best :: Int -- Line length
best w_ r_ p
= get (iUnbox w_) p
where
best w_ r_ p
= get (iUnbox w_) p
where
- r = iUnbox r_
+ !r = iUnbox r_
get :: FastInt -- (Remaining) width of line
-> Doc -> Doc
get _ Empty = Empty
get :: FastInt -- (Remaining) width of line
-> Doc -> Doc
get _ Empty = Empty
@@
-1042,9
+1043,12
@@
hPutLitString handle a l = if l ==# _ILIT(0)
printLeftRender :: Handle -> Doc -> IO ()
printLeftRender hdl doc = do
b <- newBufHandle hdl
printLeftRender :: Handle -> Doc -> IO ()
printLeftRender hdl doc = do
b <- newBufHandle hdl
- layLeft b (reduceDoc doc)
+ bufLeftRender b doc
bFlush b
bFlush b
+bufLeftRender :: BufHandle -> Doc -> IO ()
+bufLeftRender b doc = layLeft b (reduceDoc doc)
+
-- HACK ALERT! the "return () >>" below convinces GHC to eta-expand
-- this function with the IO state lambda. Otherwise we end up with
-- closures in all the case branches.
-- HACK ALERT! the "return () >>" below convinces GHC to eta-expand
-- this function with the IO state lambda. Otherwise we end up with
-- closures in all the case branches.