[commit: ghc] master: Improve the desugaring of -XStrict (4636886)

git at git.haskell.org git at git.haskell.org
Mon Jul 31 12:37:18 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/46368868dc85fc7f0c95fe88af892ad850ed7bc6/ghc

>---------------------------------------------------------------

commit 46368868dc85fc7f0c95fe88af892ad850ed7bc6
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Jul 31 10:49:16 2017 +0100

    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


>---------------------------------------------------------------

46368868dc85fc7f0c95fe88af892ad850ed7bc6
 compiler/deSugar/Coverage.hs                       |  25 ---
 compiler/deSugar/DsBinds.hs                        | 236 +++++++++------------
 compiler/deSugar/DsExpr.hs                         |  11 -
 compiler/deSugar/DsMeta.hs                         |   1 -
 compiler/hsSyn/HsBinds.hs                          |  81 ++++---
 compiler/hsSyn/HsPat.hs                            |   2 -
 compiler/hsSyn/HsUtils.hs                          |  76 +++----
 compiler/typecheck/TcBinds.hs                      |  32 +--
 compiler/typecheck/TcClassDcl.hs                   |   9 +-
 compiler/typecheck/TcHsSyn.hs                      |  76 +++----
 compiler/typecheck/TcInstDcls.hs                   |  20 +-
 testsuite/tests/ghc-api/T6145.hs                   |   2 -
 .../should_compile/DumpTypecheckedAst.stderr       |   3 +-
 utils/ghctags/Main.hs                              |   1 -
 14 files changed, 250 insertions(+), 325 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 46368868dc85fc7f0c95fe88af892ad850ed7bc6


More information about the ghc-commits mailing list