[commit: ghc] wip/ghc-8.0-det: Kill some unnecessary varSetElems (7bfc8c0)

git at git.haskell.org git at git.haskell.org
Mon Jul 25 14:57:53 UTC 2016


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

On branch  : wip/ghc-8.0-det
Link       : http://ghc.haskell.org/trac/ghc/changeset/7bfc8c039bd4f4ac82f919e6229660013afdec42/ghc

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

commit 7bfc8c039bd4f4ac82f919e6229660013afdec42
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Fri Apr 15 04:46:21 2016 -0700

    Kill some unnecessary varSetElems
    
    When you do `varSetElems (tyCoVarsOfType x)` it's equivalent to
    `tyCoVarsOfTypeList x`.
    
    Why? If you look at the implementation:
    ```
    tyCoVarsOfTypeList ty = runFVList $ tyCoVarsOfTypeAcc ty
    tyCoVarsOfType ty = runFVSet $ tyCoVarsOfTypeAcc ty
    ```
    they use the same helper function. The helper function returns a
    deterministically ordered list and a set. The only difference
    between the two is which part of the result they take. It is redundant
    to take the set and then immediately convert it to a list.
    
    This helps with determinism and we eventually want to replace the uses
    of `varSetElems` with functions that don't leak the values of uniques.
    This change gets rid of some instances that are easy to kill.
    
    I chose not to annotate every place where I got rid of `varSetElems`
    with a comment about non-determinism, because once we get rid of
    `varSetElems` it will not be possible to do the wrong thing.
    
    Test Plan: ./validate
    
    Reviewers: goldfire, austin, simonmar, bgamari, simonpj
    
    Reviewed By: simonpj
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2115
    
    GHC Trac Issues: #4012
    
    (cherry picked from commit 928d74733975fe4677e2b558d031779f58a0883c)


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

7bfc8c039bd4f4ac82f919e6229660013afdec42
 compiler/coreSyn/CoreFVs.hs      | 40 ++++++++++++++++++++++++++++++++++++----
 compiler/coreSyn/CoreLint.hs     |  4 ++--
 compiler/deSugar/Desugar.hs      |  6 ++++--
 compiler/deSugar/DsArrows.hs     |  2 +-
 compiler/deSugar/DsBinds.hs      |  4 +++-
 compiler/main/InteractiveEval.hs |  7 +++----
 compiler/main/TidyPgm.hs         |  2 +-
 compiler/specialise/Rules.hs     |  4 ++--
 compiler/typecheck/TcErrors.hs   |  2 +-
 compiler/typecheck/TcInteract.hs |  2 +-
 compiler/typecheck/TcSimplify.hs |  5 +++--
 compiler/typecheck/TcTyDecls.hs  |  4 ++--
 compiler/typecheck/TcValidity.hs |  5 +++--
 13 files changed, 62 insertions(+), 25 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 7bfc8c039bd4f4ac82f919e6229660013afdec42


More information about the ghc-commits mailing list