[commit: ghc] master: Less Tc inside simplCore (Phase 1 for #14391) (bb3fa2d)

git at git.haskell.org git at git.haskell.org
Tue May 15 23:37:50 UTC 2018


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

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

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

commit bb3fa2d18686d0c08b57c66a90a9ea1b4e4482ee
Author: Artem Pelenitsyn <a.pelenitsyn at gmail.com>
Date:   Tue May 15 18:07:23 2018 -0400

    Less Tc inside simplCore (Phase 1 for #14391)
    
    Simplifier depends on typechecker in two points: `thNameToGhcName`
    (`lookupThName_maybe`, in particular)  and `lookupGlobal`. We want to
    cut the ties in two steps.
    
    1. (Presented in this commit), reimplement both functions in a way that
    doesn't use typechecker.
    
    2. (Should follow), do code moving: a) `lookupGlobal` should go in some
    typechecker-free place; b) `thNameToGhcName` should leave simplifier,
    because it is not used there at all (probably, it should be placed
    somewhere where `GhcPlugins` can see it -- this is suggested by Joachim
    on Trac).
    
    Details
    =======
    
    We redesigned lookup interface a bit so that it exposes some
    `IO`-equivalents of `Tc`-features in use.
    
    First, `CoreMonad.hs` still calls `lookupGlobal` which is no longer
    bound to the typechecker monad, but still resides in `TcEnv.hs` — it
    should be moved out of Tc-land at some point (“Phase 2”) in the
    future in order to achieve its part of the #14391's goal.
    
    Second, `lookupThName_maybe` is eliminated from `CoreMonad.hs`
    completely; this already achieves its part of the goal of #14391. Its
    client, though, `thNameToGhcName`, is better to be moved in the future
    also, for it is not used in the `CoreMonad.hs` (or anywhere else)
    anyway. Joachim suggested “any module reexported by GhcPlugins (or
    maybe even that module itself)”.
    
    As a side goal, we removed `initTcForLookup` which was instrumental for
    the past version of `lookupGlobal`. This, in turn, called for pushing
    some more parts of the lookup interface from the `Tc`-monad to `IO`,
    most notably, adding `IO`-version of `lookupOrig` and pushing
    `dataConInfoPtrToName` to `IO`. The `lookupOrig` part, in turn,
    triggered a slight redesign of name cache updating interface: we now
    have both, `updNameCacheIO` and `updNameCacheTc`, both accepting `mod`
    and `occ` to force them inside, instead of more error-prone outside
    before. But all these hardly have to do anything with #14391, mere
    refactoring.
    
    Reviewers: simonpj, nomeata, bgamari, hvr
    
    Reviewed By: simonpj, bgamari
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #14391
    
    Differential Revision: https://phabricator.haskell.org/D4503


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

bb3fa2d18686d0c08b57c66a90a9ea1b4e4482ee
 compiler/ghci/DebuggerUtils.hs         | 20 ++++----
 compiler/ghci/RtClosureInspect.hs      |  8 ++--
 compiler/iface/IfaceEnv.hs             | 83 ++++++++++++++++++++++------------
 compiler/iface/LoadIface.hs            |  1 +
 compiler/main/DynFlags.hs              |  7 +++
 compiler/main/HscTypes.hs              | 10 ++--
 compiler/simplCore/CoreMonad.hs        | 24 +++++++---
 compiler/typecheck/TcEnv.hs            | 74 ++++++++++++++++++++++++++----
 compiler/typecheck/TcRnMonad.hs        | 16 +------
 testsuite/tests/ghc-api/T4891/T4891.hs | 15 +++---
 10 files changed, 170 insertions(+), 88 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 bb3fa2d18686d0c08b57c66a90a9ea1b4e4482ee


More information about the ghc-commits mailing list