[commit: ghc] wip/T9388: Remove old state hack (1393b8a)

git at git.haskell.org git at git.haskell.org
Sun Feb 22 12:48:57 UTC 2015


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

On branch  : wip/T9388
Link       : http://ghc.haskell.org/trac/ghc/changeset/1393b8a61db55a149003562cbcdf78789195a93a/ghc

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

commit 1393b8a61db55a149003562cbcdf78789195a93a
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Sun Feb 22 10:35:21 2015 +0100

    Remove old state hack
    
    which applies the state hack to every lambda with a binder of type
    State# a, which destroys wanted sharing.


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

1393b8a61db55a149003562cbcdf78789195a93a
 compiler/basicTypes/Id.hs     | 14 ++------------
 compiler/basicTypes/MkId.hs   |  3 +--
 compiler/coreSyn/CoreArity.hs |  2 +-
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs
index 14e789b..23d9c30 100644
--- a/compiler/basicTypes/Id.hs
+++ b/compiler/basicTypes/Id.hs
@@ -71,7 +71,7 @@ module Id (
         isOneShotBndr, isOneShotLambda, isProbablyOneShotLambda,
         setOneShotLambda, clearOneShotLambda,
         updOneShotInfo, setIdOneShotInfo,
-        isStateHackType, stateHackOneShot, typeOneShot,
+        isStateHackType,
 
         -- ** Reading 'IdInfo' fields
         idArity,
@@ -245,8 +245,7 @@ mkVanillaGlobalWithInfo = mkGlobalId VanillaId
 
 -- | For an explanation of global vs. local 'Id's, see "Var#globalvslocal"
 mkLocalId :: Name -> Type -> Id
-mkLocalId name ty = mkLocalIdWithInfo name ty
-                         (vanillaIdInfo `setOneShotInfo` typeOneShot ty)
+mkLocalId name ty = mkLocalIdWithInfo name ty vanillaIdInfo
 
 mkLocalIdWithInfo :: Name -> Type -> IdInfo -> Id
 mkLocalIdWithInfo name ty info = Var.mkLocalVar VanillaId name ty info
@@ -649,15 +648,6 @@ isOneShotBndr var
   | isTyVar var = True
   | otherwise   = isOneShotLambda var
 
--- | Should we apply the state hack to values of this 'Type'?
-stateHackOneShot :: OneShotInfo
-stateHackOneShot = OneShotLam         -- Or maybe ProbOneShot?
-
-typeOneShot :: Type -> OneShotInfo
-typeOneShot ty
-   | isStateHackType ty = stateHackOneShot
-   | otherwise          = NoOneShotInfo
-
 isStateHackType :: Type -> Bool
 isStateHackType ty
   | opt_NoStateHack
diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs
index 0b22a64..d1915e1 100644
--- a/compiler/basicTypes/MkId.hs
+++ b/compiler/basicTypes/MkId.hs
@@ -1341,8 +1341,7 @@ inlined.
 
 realWorldPrimId :: Id   -- :: State# RealWorld
 realWorldPrimId = pcMiscPrelId realWorldName realWorldStatePrimTy
-                     (noCafIdInfo `setUnfoldingInfo` evaldUnfolding    -- Note [evaldUnfoldings]
-                                  `setOneShotInfo` stateHackOneShot)
+                     (noCafIdInfo `setUnfoldingInfo` evaldUnfolding)   -- Note [evaldUnfoldings]
 
 voidPrimId :: Id     -- Global constant :: Void#
 voidPrimId  = pcMiscPrelId voidPrimIdName voidPrimTy
diff --git a/compiler/coreSyn/CoreArity.hs b/compiler/coreSyn/CoreArity.hs
index 5e50642..7e054e4 100644
--- a/compiler/coreSyn/CoreArity.hs
+++ b/compiler/coreSyn/CoreArity.hs
@@ -110,7 +110,7 @@ typeArity ty
       = go rec_nts ty'
 
       | Just (arg,res) <- splitFunTy_maybe ty
-      = typeOneShot arg : go rec_nts res
+      = NoOneShotInfo : go rec_nts res
       | Just (tc,tys) <- splitTyConApp_maybe ty
       , Just (ty', _) <- instNewTyCon_maybe tc tys
       , Just rec_nts' <- checkRecTc rec_nts tc  -- See Note [Expanding newtypes]



More information about the ghc-commits mailing list