diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-07-31 10:49:16 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-07-31 13:36:49 +0100 |
commit | 46368868dc85fc7f0c95fe88af892ad850ed7bc6 (patch) | |
tree | 4e290b5580fa55e445712f5a0653bcb3c229c30b /compiler/deSugar/Coverage.hs | |
parent | 2535a6716202253df74d8190b028f85cc6d21b72 (diff) | |
download | haskell-46368868dc85fc7f0c95fe88af892ad850ed7bc6.tar.gz |
Improve the desugaring of -XStrict
Trac #14035 showed that -XStrict was generating some TERRIBLE
desugarings, espcially for bindings with INLINE pragmas. Reason: with
-XStrict, all AbsBinds (even for non-recursive functions) went via the
general-case deguaring for AbsBinds, namely "generate a tuple and
select from it", even though in this case there was only one variable
in the tuple. And that in turn interacts terribly badly with INLINE
pragmas.
This patch cleans things up:
* I killed off AbsBindsSig completely, in favour of a boolean flag
abs_sig in AbsBinds. See Note [The abs_sig field of AbsBinds]
This allowed me to delete lots of code; and instance-method
declarations can enjoy the benefits too. (They could have
before, but no one had changed them to use AbsBindsSig.)
* I refactored all the AbsBinds handling in DsBinds into a new
function DsBinds.dsAbsBinds. This allowed me to handle the
strict case uniformly
Diffstat (limited to 'compiler/deSugar/Coverage.hs')
-rw-r--r-- | compiler/deSugar/Coverage.hs | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/compiler/deSugar/Coverage.hs b/compiler/deSugar/Coverage.hs index 16537bd7a5..d44c203b6f 100644 --- a/compiler/deSugar/Coverage.hs +++ b/compiler/deSugar/Coverage.hs @@ -281,31 +281,6 @@ addTickLHsBind (L pos bind@(AbsBinds { abs_binds = binds, | ABE{ abe_poly = pid, abe_mono = mid } <- abs_exports , isInlinePragma (idInlinePragma pid) ] } -addTickLHsBind (L pos bind@(AbsBindsSig { abs_sig_bind = val_bind - , abs_sig_export = poly_id })) - | L _ FunBind { fun_id = L _ mono_id } <- val_bind - = do withEnv (add_export mono_id) $ do - withEnv (add_inlines mono_id) $ do - val_bind' <- addTickLHsBind val_bind - return $ L pos $ bind { abs_sig_bind = val_bind' } - - | otherwise - = pprPanic "addTickLHsBind" (ppr bind) - where - -- see AbsBinds comments - add_export mono_id env - | idName poly_id `elemNameSet` exports env - = env { exports = exports env `extendNameSet` idName mono_id } - | otherwise - = env - - -- See Note [inline sccs] - add_inlines mono_id env - | isInlinePragma (idInlinePragma poly_id) - = env { inlines = inlines env `extendVarSet` mono_id } - | otherwise - = env - addTickLHsBind (L pos (funBind@(FunBind { fun_id = (L _ id) }))) = do let name = getOccString id decl_path <- getPathEntry |