diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2013-09-02 09:46:59 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2013-09-02 09:52:45 +0100 |
commit | e4a1d2d0a71bf335a04eaf93deb440b709f9430e (patch) | |
tree | 0656b50cd5455ffb0a960be910ea52fb45444252 /compiler/iface | |
parent | 5f98d44d8617756971cf47c040f2556de4e98f63 (diff) | |
download | haskell-e4a1d2d0a71bf335a04eaf93deb440b709f9430e.tar.gz |
Remove the final vestiges of InlineWrappers
Part of Nick Frisby's patch (c080f727ba5f83921b842fcff71e9066adbdc250)
for late demand-analysis removed the over-zealous short-cut whereby
strictness wrappers were not spelled out in detail in interface files.
This patch completes the process by
* removing InlineWrapper from UnfoldingSource
* removing IfWrapper from IfaceUnfolding
There was a tiny bit of special ad-hocery for wrappers, in OccurAnal,
but fortunately that too turns out to be rendered irrelevant by
the more uniform treatment, and after that there was no need
to remember which functions are wrappers.
Diffstat (limited to 'compiler/iface')
-rw-r--r-- | compiler/iface/IfaceSyn.lhs | 15 | ||||
-rw-r--r-- | compiler/iface/MkIface.lhs | 1 | ||||
-rw-r--r-- | compiler/iface/TcIface.lhs | 29 |
3 files changed, 3 insertions, 42 deletions
diff --git a/compiler/iface/IfaceSyn.lhs b/compiler/iface/IfaceSyn.lhs index 8dc4188bb9..f6e68e2836 100644 --- a/compiler/iface/IfaceSyn.lhs +++ b/compiler/iface/IfaceSyn.lhs @@ -583,8 +583,6 @@ data IfaceUnfolding Bool -- OK to inline even if context is boring IfaceExpr - | IfWrapper IfaceExpr -- cf TcIface's Note [wrappers in interface files] - | IfDFunUnfold [IfaceBndr] [IfaceExpr] instance Binary IfaceUnfolding where @@ -598,15 +596,12 @@ instance Binary IfaceUnfolding where put_ bh b put_ bh c put_ bh d - put_ bh (IfWrapper e) = do - putByte bh 2 - put_ bh e put_ bh (IfDFunUnfold as bs) = do - putByte bh 3 + putByte bh 2 put_ bh as put_ bh bs put_ bh (IfCompulsory e) = do - putByte bh 4 + putByte bh 3 put_ bh e get bh = do h <- getByte bh @@ -619,9 +614,7 @@ instance Binary IfaceUnfolding where c <- get bh d <- get bh return (IfInlineRule a b c d) - 2 -> do e <- get bh - return (IfWrapper e) - 3 -> do as <- get bh + 2 -> do as <- get bh bs <- get bh return (IfDFunUnfold as bs) _ -> do e <- get bh @@ -1288,7 +1281,6 @@ instance Outputable IfaceUnfolding where ppr (IfInlineRule a uok bok e) = sep [ptext (sLit "InlineRule") <+> ppr (a,uok,bok), pprParendIfaceExpr e] - ppr (IfWrapper e) = ptext (sLit "Wrapper:") <+> parens (ppr e) ppr (IfDFunUnfold bs es) = hang (ptext (sLit "DFun:") <+> sep (map ppr bs) <> dot) 2 (sep (map pprParendIfaceExpr es)) @@ -1446,7 +1438,6 @@ freeNamesIfUnfold :: IfaceUnfolding -> NameSet freeNamesIfUnfold (IfCoreUnfold _ e) = freeNamesIfExpr e freeNamesIfUnfold (IfCompulsory e) = freeNamesIfExpr e freeNamesIfUnfold (IfInlineRule _ _ _ e) = freeNamesIfExpr e -freeNamesIfUnfold (IfWrapper e) = freeNamesIfExpr e freeNamesIfUnfold (IfDFunUnfold bs es) = fnList freeNamesIfBndr bs &&& fnList freeNamesIfExpr es freeNamesIfExpr :: IfaceExpr -> NameSet diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index d3b56d1f7b..44f99d520e 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -1762,7 +1762,6 @@ toIfUnfolding lb (CoreUnfolding { uf_tmpl = rhs, uf_arity = arity -> case guidance of UnfWhen unsat_ok boring_ok -> IfInlineRule arity unsat_ok boring_ok if_rhs _other -> IfCoreUnfold True if_rhs - InlineWrapper -> IfWrapper if_rhs InlineCompulsory -> IfCompulsory if_rhs InlineRhs -> IfCoreUnfold False if_rhs -- Yes, even if guidance is UnfNever, expose the unfolding diff --git a/compiler/iface/TcIface.lhs b/compiler/iface/TcIface.lhs index dffd69b9ed..e1077e0f2d 100644 --- a/compiler/iface/TcIface.lhs +++ b/compiler/iface/TcIface.lhs @@ -1204,25 +1204,6 @@ do_one (IfaceRec pairs) thing_inside %* * %************************************************************************ -Note [wrappers in interface files] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -We used to have a nice clever scheme in interface files for -wrappers. A wrapper's unfolding can be reconstructed from its worker's -id and its strictness. This decreased .hi file size (sometimes -significantly, for modules like GHC.Classes with many high-arity w/w -splits) and had a slight corresponding effect on compile times. - -However, when we added the second demand analysis, this scheme lead to -some Core lint errors. The second analysis could change the strictness -signatures, which sometimes resulted in a wrapper's regenerated -unfolding applying the wrapper to too many arguments. - -Instead of repairing the clever .hi scheme, we abandoned it in favor -of simplicity. The .hi sizes are usually insignificant (excluding the -+1M for base libraries), and compile time barely increases (~+1% for -nofib). The nicer upshot is that unfolding sources no longer include -an Id, so, eg, substitutions need not traverse them any longer. - \begin{code} tcIdDetails :: Type -> IfaceIdDetails -> IfL IdDetails tcIdDetails _ IfVanillaId = return VanillaId @@ -1300,16 +1281,6 @@ tcUnfolding name dfun_ty _ (IfDFunUnfold bs ops) where doc = text "Class ops for dfun" <+> ppr name (_, _, cls, _) = tcSplitDFunTy dfun_ty - -tcUnfolding name _ info (IfWrapper if_expr) - = do { mb_expr <- tcPragExpr name if_expr - ; return $ case mb_expr of - Nothing -> NoUnfolding - Just expr -> mkWwInlineRule expr arity -- see Note [wrappers in interface files] - } - where - -- Arity should occur before unfolding! - arity = arityInfo info \end{code} For unfoldings we try to do the job lazily, so that we never type check |