[commit: ghc] ghc-7.10: Custom `Typeable` solver, that keeps track of kinds. (6f46fe1)

git at git.haskell.org git at git.haskell.org
Fri Mar 13 21:49:00 UTC 2015


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

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/6f46fe15af397d448438c6b93babcdd68dd78df8/ghc

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

commit 6f46fe15af397d448438c6b93babcdd68dd78df8
Author: Iavor S. Diatchki <diatchki at galois.com>
Date:   Sat Mar 7 10:37:31 2015 -0600

    Custom `Typeable` solver, that keeps track of kinds.
    
    Summary:
    This implements the new `Typeable` solver: when GHC sees `Typeable` constraints
    it solves them on the spot.
    
    The current implementation creates `TyCon` representations on the spot.
    
    Pro: No overhead at all in code that does not use `Typeable`
    Cons: Code that uses `Typeable` may create multipe `TyCon` represntations.
    
    We have discussed an implementation where representations of `TyCons` are
    computed once, in the module, where a datatype is declared.  This would
    lead to more code being generated:  for a promotable datatype we need to
    generate `2 + number_of_data_cons` type-constructro representations,
    and we have to do that for all programs, even ones that do not intend to
    use typeable.
    
    I added code to emit warning whenevar `deriving Typeable` is encountered---
    the idea being that this is not needed anymore, and shold be fixed.
    
    Also, we allow `instance Typeable T` in .hs-boot files, but they result
    in a warning, and are ignored.  This last one was to avoid breaking exisitng
    code, and should become an error, eventually.
    
    Test Plan:
    1. GHC can compile itself.
    2. I compiled a number of large libraries, including `lens`.
        - I had to make some small changes:
          `unordered-containers` uses internals of `TypeReps`, so I had to do a 1 line fix
        - `lens` needed one instance changed, due to a poly-kinded `Typeble` instance
    
    3. I also run some code that uses `syb` to traverse a largish datastrucutre.
    I didn't notice any signifiant performance difference between the 7.8.3 version,
    and this implementation.
    
    Reviewers: simonpj, simonmar, austin, hvr
    
    Reviewed By: austin, hvr
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D652
    
    GHC Trac Issues: #9858
    
    (cherry picked from commit b359c886cd7578ed083bcedcea05d315ecaeeb54)


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

6f46fe15af397d448438c6b93babcdd68dd78df8
 compiler/basicTypes/MkId.hs                        |   1 +
 compiler/deSugar/DsBinds.hs                        | 129 +++++++++-
 compiler/main/DynFlags.hs                          |   2 +
 compiler/prelude/PrelNames.hs                      |  43 +++-
 compiler/typecheck/TcDeriv.hs                      | 232 +++++++-----------
 compiler/typecheck/TcEvidence.hs                   |  35 ++-
 compiler/typecheck/TcGenDeriv.hs                   |  52 -----
 compiler/typecheck/TcHsSyn.hs                      |  14 ++
 compiler/typecheck/TcInstDcls.hs                   |  49 ++--
 compiler/typecheck/TcInteract.hs                   |  62 ++++-
 docs/users_guide/flags.xml                         |  19 +-
 docs/users_guide/glasgow_exts.xml                  |  53 +++--
 libraries/base/Data/Typeable/Internal.hs           | 260 ++++-----------------
 testsuite/tests/deriving/should_compile/all.T      |   2 +-
 testsuite/tests/deriving/should_fail/T2604.hs      |   9 -
 testsuite/tests/deriving/should_fail/T2604.stderr  |  10 -
 testsuite/tests/deriving/should_fail/T5863a.hs     |  12 -
 testsuite/tests/deriving/should_fail/T5863a.stderr |  10 -
 testsuite/tests/deriving/should_fail/T7800.hs      |   7 -
 testsuite/tests/deriving/should_fail/T7800.stderr  |   6 -
 testsuite/tests/deriving/should_fail/T7800a.hs     |   4 -
 testsuite/tests/deriving/should_fail/T9687.stderr  |   4 +-
 testsuite/tests/deriving/should_fail/all.T         |   6 +-
 .../tests/ghci.debugger/scripts/print019.stderr    |  12 +-
 testsuite/tests/polykinds/T8132.stderr             |   4 +-
 testsuite/tests/typecheck/should_compile/T9999.hs  |  13 --
 testsuite/tests/typecheck/should_compile/all.T     |   1 -
 .../should_fail/TcStaticPointersFail02.stderr      |   4 +-
 testsuite/tests/typecheck/should_fail/all.T        |   1 +
 29 files changed, 486 insertions(+), 570 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 6f46fe15af397d448438c6b93babcdd68dd78df8


More information about the ghc-commits mailing list