[commit: ghc] master: Packages: Kill unused UnitId argument to isDllName (c889df8)

git at git.haskell.org git at git.haskell.org
Fri Dec 16 17:11:35 UTC 2016


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

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

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

commit c889df86d7bc9eb4cd53e38c81feecaf5f932678
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Fri Dec 16 11:59:26 2016 -0500

    Packages: Kill unused UnitId argument to isDllName
    
    Test Plan: Validate
    
    Reviewers: austin, simonmar
    
    Subscribers: thomie, ezyang
    
    Differential Revision: https://phabricator.haskell.org/D2866


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

c889df86d7bc9eb4cd53e38c81feecaf5f932678
 compiler/cmm/CLabel.hs    |  2 +-
 compiler/main/Packages.hs |  4 ++--
 compiler/main/TidyPgm.hs  | 23 +++++++++++------------
 compiler/stgSyn/StgSyn.hs |  6 ++----
 4 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
index 3fd081c..811d8e9 100644
--- a/compiler/cmm/CLabel.hs
+++ b/compiler/cmm/CLabel.hs
@@ -952,7 +952,7 @@ labelDynamic dflags this_pkg this_mod lbl =
    -- is the RTS in a DLL or not?
    RtsLabel _           -> (WayDyn `elem` ways dflags) && (this_pkg /= rtsUnitId)
 
-   IdLabel n _ _        -> isDllName dflags this_pkg this_mod n
+   IdLabel n _ _        -> isDllName dflags this_mod n
 
    -- When compiling in the "dyn" way, each package is to be linked into
    -- its own shared library.
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index 86a3735..b6b5e3c 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -1747,11 +1747,11 @@ displayInstalledUnitId dflags uid =
     fmap sourcePackageIdString (lookupInstalledPackage dflags uid)
 
 -- | Will the 'Name' come from a dynamically linked library?
-isDllName :: DynFlags -> UnitId {- not used -} -> Module -> Name -> Bool
+isDllName :: DynFlags -> Module -> Name -> Bool
 -- Despite the "dll", I think this function just means that
 -- the symbol comes from another dynamically-linked package,
 -- and applies on all platforms, not just Windows
-isDllName dflags _this_pkg this_mod name
+isDllName dflags this_mod name
   | WayDyn `notElem` ways dflags = False
   | Just mod <- nameModule_maybe name
     -- Issue #8696 - when GHC is dynamically linked, it will attempt
diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs
index 9f2723c..c4057fc 100644
--- a/compiler/main/TidyPgm.hs
+++ b/compiler/main/TidyPgm.hs
@@ -1132,18 +1132,15 @@ tidyTopBinds hsc_env this_mod unfold_env init_occ_env binds
 
     init_env = (init_occ_env, emptyVarEnv)
 
-    this_pkg = thisPackage dflags
-
     tidy _           env []     = (env, [])
     tidy cvt_integer env (b:bs)
-        = let (env1, b')  = tidyTopBind dflags this_pkg this_mod
+        = let (env1, b')  = tidyTopBind dflags this_mod
                                         cvt_integer unfold_env env b
               (env2, bs') = tidy cvt_integer env1 bs
           in  (env2, b':bs')
 
 ------------------------
 tidyTopBind  :: DynFlags
-             -> UnitId
              -> Module
              -> (Integer -> CoreExpr)
              -> UnfoldEnv
@@ -1151,17 +1148,19 @@ tidyTopBind  :: DynFlags
              -> CoreBind
              -> (TidyEnv, CoreBind)
 
-tidyTopBind dflags this_pkg this_mod cvt_integer unfold_env
+tidyTopBind dflags this_mod cvt_integer unfold_env
             (occ_env,subst1) (NonRec bndr rhs)
   = (tidy_env2,  NonRec bndr' rhs')
   where
     Just (name',show_unfold) = lookupVarEnv unfold_env bndr
-    caf_info      = hasCafRefs dflags this_pkg this_mod (subst1, cvt_integer) (idArity bndr) rhs
-    (bndr', rhs') = tidyTopPair dflags show_unfold tidy_env2 caf_info name' (bndr, rhs)
+    caf_info      = hasCafRefs dflags this_mod (subst1, cvt_integer)
+                               (idArity bndr) rhs
+    (bndr', rhs') = tidyTopPair dflags show_unfold tidy_env2 caf_info name'
+                                (bndr, rhs)
     subst2        = extendVarEnv subst1 bndr bndr'
     tidy_env2     = (occ_env, subst2)
 
-tidyTopBind dflags this_pkg this_mod cvt_integer unfold_env
+tidyTopBind dflags this_mod cvt_integer unfold_env
             (occ_env, subst1) (Rec prs)
   = (tidy_env2, Rec prs')
   where
@@ -1179,7 +1178,7 @@ tidyTopBind dflags this_pkg this_mod cvt_integer unfold_env
         -- the CafInfo for a recursive group says whether *any* rhs in
         -- the group may refer indirectly to a CAF (because then, they all do).
     caf_info
-        | or [ mayHaveCafRefs (hasCafRefs dflags this_pkg this_mod
+        | or [ mayHaveCafRefs (hasCafRefs dflags this_mod
                                           (subst1, cvt_integer)
                                           (idArity bndr) rhs)
              | (bndr,rhs) <- prs ] = MayHaveCafRefs
@@ -1331,15 +1330,15 @@ type CafRefEnv = (VarEnv Id, Integer -> CoreExpr)
   -- The Integer -> CoreExpr is the desugaring function for Integer literals
   -- See Note [Disgusting computation of CafRefs]
 
-hasCafRefs :: DynFlags -> UnitId -> Module
+hasCafRefs :: DynFlags -> Module
            -> CafRefEnv -> Arity -> CoreExpr
            -> CafInfo
-hasCafRefs dflags this_pkg this_mod p@(_,cvt_integer) arity expr
+hasCafRefs dflags this_mod p@(_,cvt_integer) arity expr
   | is_caf || mentions_cafs = MayHaveCafRefs
   | otherwise               = NoCafRefs
  where
   mentions_cafs   = cafRefsE p expr
-  is_dynamic_name = isDllName dflags this_pkg this_mod
+  is_dynamic_name = isDllName dflags this_mod
   is_caf = not (arity > 0 || rhsIsStatic (targetPlatform dflags) is_dynamic_name cvt_integer expr)
 
   -- NB. we pass in the arity of the expression, which is expected
diff --git a/compiler/stgSyn/StgSyn.hs b/compiler/stgSyn/StgSyn.hs
index b553cd7..3ec37ee 100644
--- a/compiler/stgSyn/StgSyn.hs
+++ b/compiler/stgSyn/StgSyn.hs
@@ -98,18 +98,16 @@ data GenStgArg occ
 isDllConApp :: DynFlags -> Module -> DataCon -> [StgArg] -> Bool
 isDllConApp dflags this_mod con args
  | platformOS (targetPlatform dflags) == OSMinGW32
-    = isDllName dflags this_pkg this_mod (dataConName con) || any is_dll_arg args
+    = isDllName dflags this_mod (dataConName con) || any is_dll_arg args
  | otherwise = False
   where
     -- NB: typePrimRep is legit because any free variables won't have
     -- unlifted type (there are no unlifted things at top level)
     is_dll_arg :: StgArg -> Bool
     is_dll_arg (StgVarArg v) =  isAddrRep (typePrimRep (idType v))
-                             && isDllName dflags this_pkg this_mod (idName v)
+                             && isDllName dflags this_mod (idName v)
     is_dll_arg _             = False
 
-    this_pkg = thisPackage dflags
-
 -- True of machine addresses; these are the things that don't
 -- work across DLLs. The key point here is that VoidRep comes
 -- out False, so that a top level nullary GADT constructor is



More information about the ghc-commits mailing list