[commit: ghc] master: Refactor coercion rule (55a3f85)

git at git.haskell.org git at git.haskell.org
Tue Jul 10 01:38:59 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/55a3f8552c9dc9b84e204ec6623c698912795347/ghc

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

commit 55a3f8552c9dc9b84e204ec6623c698912795347
Author: ningning <xnningxie at gmail.com>
Date:   Mon Jul 9 20:02:03 2018 -0400

    Refactor coercion rule
    
    Summary:
    The patch is an attempt on #15192.
    
    It defines a new coercion rule
    
    ```
     | GRefl Role Type MCoercion
    ```
    
    which correspondes to the typing rule
    
    ```
         t1 : k1
      ------------------------------------
      GRefl r t1 MRefl: t1 ~r t1
    
         t1 : k1       co :: k1 ~ k2
      ------------------------------------
      GRefl r t1 (MCo co) : t1 ~r t1 |> co
    ```
    
    MCoercion wraps a coercion, which might be reflexive (MRefl)
    or not (MCo co). To know more about MCoercion see #14975.
    
    We keep Refl ty as a special case for nominal reflexive coercions,
    naemly, Refl ty :: ty ~n ty.
    
    This commit is meant to be a general performance improvement,
    but there are a few regressions. See #15192, comment:13 for
    more information.
    
    Test Plan: ./validate
    
    Reviewers: bgamari, goldfire, simonpj
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #15192
    
    Differential Revision: https://phabricator.haskell.org/D4747


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

55a3f8552c9dc9b84e204ec6623c698912795347
 compiler/backpack/RnModIface.hs     |   9 +-
 compiler/coreSyn/CoreFVs.hs         |   8 +-
 compiler/coreSyn/CoreLint.hs        |  25 ++-
 compiler/coreSyn/CoreOpt.hs         |   2 +-
 compiler/iface/IfaceSyn.hs          |  10 +-
 compiler/iface/IfaceType.hs         | 106 +++++++-----
 compiler/iface/TcIface.hs           |   8 +-
 compiler/iface/ToIface.hs           |   7 +-
 compiler/typecheck/TcCanonical.hs   |  21 ++-
 compiler/typecheck/TcEvidence.hs    |  14 +-
 compiler/typecheck/TcFlatten.hs     |  85 +++++----
 compiler/typecheck/TcTyDecls.hs     |   9 +-
 compiler/typecheck/TcType.hs        |   7 +-
 compiler/typecheck/TcUnify.hs       |  12 +-
 compiler/typecheck/TcValidity.hs    |   8 +-
 compiler/types/Coercion.hs          | 334 +++++++++++++++++++++++-------------
 compiler/types/Coercion.hs-boot     |   4 +-
 compiler/types/FamInstEnv.hs        |  16 +-
 compiler/types/OptCoercion.hs       | 101 ++++++-----
 compiler/types/TyCoRep.hs           | 118 +++++++++----
 compiler/types/TyCoRep.hs-boot      |   3 +
 compiler/types/Type.hs              |  54 +++---
 compiler/types/Unify.hs             |  49 ++++--
 testsuite/tests/perf/compiler/all.T |   3 +-
 24 files changed, 637 insertions(+), 376 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 55a3f8552c9dc9b84e204ec6623c698912795347


More information about the ghc-commits mailing list