X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fstranal%2FWorkWrap.lhs;h=3667da80837aa889f17c3ebd531ad3fd20e1df16;hb=9fddc2160c524d4fefb9fc8a42704f812aef7bf3;hp=a1b18a98fb2d00266614aa2016b97e49dbc417cb;hpb=481b014b46dd53ef5d1c5e679e1d9f08207af96e;p=ghc-hetmet.git diff --git a/compiler/stranal/WorkWrap.lhs b/compiler/stranal/WorkWrap.lhs index a1b18a9..3667da8 100644 --- a/compiler/stranal/WorkWrap.lhs +++ b/compiler/stranal/WorkWrap.lhs @@ -4,6 +4,13 @@ \section[WorkWrap]{Worker/wrapper-generating back-end of strictness analyser} \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module WorkWrap ( wwTopBinds, mkWrapper ) where #include "HsVersions.h" @@ -369,17 +376,7 @@ worthSplittingFun ds res = any worth_it ds || returnsCPR res -- worthSplitting returns False for an empty list of demands, -- and hence do_strict_ww is False if arity is zero and there is no CPR - - -- We used not to split if the result is bottom. - -- [Justification: there's no efficiency to be gained.] - -- But it's sometimes bad not to make a wrapper. Consider - -- fw = \x# -> let x = I# x# in case e of - -- p1 -> error_fn x - -- p2 -> error_fn x - -- p3 -> the real stuff - -- The re-boxing code won't go away unless error_fn gets a wrapper too. - -- [We don't do reboxing now, but in general it's better to pass - -- an unboxed thing to f, and have it reboxed in the error cases....] + -- See Note [Worker-wrapper for bottoming functions] where worth_it Abs = True -- Absent arg worth_it (Eval (Prod ds)) = True -- Product arg to evaluate @@ -396,6 +393,19 @@ worthSplittingThunk maybe_dmd res worth_it other = False \end{code} +Note [Worker-wrapper for bottoming functions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We used not to split if the result is bottom. +[Justification: there's no efficiency to be gained.] + +But it's sometimes bad not to make a wrapper. Consider + fw = \x# -> let x = I# x# in case e of + p1 -> error_fn x + p2 -> error_fn x + p3 -> the real stuff +The re-boxing code won't go away unless error_fn gets a wrapper too. +[We don't do reboxing now, but in general it's better to pass an +unboxed thing to f, and have it reboxed in the error cases....] %************************************************************************