[commit: ghc] master: pmCheck: Don't generate PmId OccNames from Uniques (6f99923)

git at git.haskell.org git at git.haskell.org
Thu May 11 21:33:28 UTC 2017


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

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

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

commit 6f999230e8f955ee61c470d34a02650165643f68
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Thu May 11 00:17:04 2017 -0400

    pmCheck: Don't generate PmId OccNames from Uniques
    
    Doug Wilson astutely noticed that the pattern match checker was spending
    a significant amount of time in mkPmId. It turns out that it was
    producing Ids with OccNames that were generated from a Unique, which are
    non-trivial to render. Since Var is strict in Name, Name in OccName, and
    OccName in its FastString all of this encoding work was being done
    despite the fact that it was (as far as I can tell) never actually
    needed.
    
    Test Plan: Validate, note allocations of `T11195`
    
    Reviewers: austin, gkaracha
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3568


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

6f999230e8f955ee61c470d34a02650165643f68
 compiler/deSugar/Check.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs
index da1f004..3215856 100644
--- a/compiler/deSugar/Check.hs
+++ b/compiler/deSugar/Check.hs
@@ -1038,7 +1038,7 @@ mkPmVars tys = mapM mkPmVar tys
 -- | Generate a fresh `Id` of a given type
 mkPmId :: Type -> DsM Id
 mkPmId ty = getUniqueM >>= \unique ->
-  let occname = mkVarOccFS (fsLit (show unique))
+  let occname = mkVarOccFS $ fsLit "$pm"
       name    = mkInternalName unique occname noSrcSpan
   in  return (mkLocalId name ty)
 



More information about the ghc-commits mailing list