summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Chinn <brandonchinn178@gmail.com>2022-06-16 13:30:47 -0700
committerMatthew Pickering <matthewtpickering@gmail.com>2022-07-05 11:08:46 +0100
commit13c81cb6be95c55cb2c12a150f71b65df310c906 (patch)
treee5c02a0bdb5b5d66ebac6e10cccc85cb1146846f
parentc6759c65a4df35063dcb288c319f5404364d09a5 (diff)
downloadhaskell-13c81cb6be95c55cb2c12a150f71b65df310c906.tar.gz
Use lookupNameCache instead of lookupOrigIO
(cherry picked from commit 19606c4208db191165285b79ebc1efe7fb7f4ae4)
-rw-r--r--compiler/GHC/Iface/Env.hs6
-rw-r--r--compiler/GHC/Plugins.hs6
-rw-r--r--compiler/GHC/Runtime/Heap/Inspect.hs2
-rw-r--r--docs/users_guide/9.4.1-notes.rst2
4 files changed, 7 insertions, 9 deletions
diff --git a/compiler/GHC/Iface/Env.hs b/compiler/GHC/Iface/Env.hs
index 9edc0edd32..eeef41ecc1 100644
--- a/compiler/GHC/Iface/Env.hs
+++ b/compiler/GHC/Iface/Env.hs
@@ -6,7 +6,7 @@ module GHC.Iface.Env (
newGlobalBinder, newInteractiveBinder,
externaliseName,
lookupIfaceTop,
- lookupOrig, lookupOrigIO, lookupOrigNameCache,
+ lookupOrig, lookupNameCache, lookupOrigNameCache,
newIfaceName, newIfaceNames,
extendIfaceIdEnv, extendIfaceTyVarEnv,
tcIfaceLclId, tcIfaceTyVar, lookupIfaceVar,
@@ -146,10 +146,6 @@ lookupOrig mod occ = do
traceIf (text "lookup_orig" <+> ppr mod <+> ppr occ)
liftIO $ lookupNameCache (hsc_NC hsc_env) mod occ
-lookupOrigIO :: HscEnv -> Module -> OccName -> IO Name
-lookupOrigIO hsc_env mod occ
- = lookupNameCache (hsc_NC hsc_env) mod occ
-
lookupNameCache :: NameCache -> Module -> OccName -> IO Name
-- Lookup up the (Module,OccName) in the NameCache
-- If you find it, return it; if not, allocate a fresh original name and extend
diff --git a/compiler/GHC/Plugins.hs b/compiler/GHC/Plugins.hs
index 2de8d8d370..c5963715b1 100644
--- a/compiler/GHC/Plugins.hs
+++ b/compiler/GHC/Plugins.hs
@@ -135,7 +135,7 @@ import GHC.Types.Unique ( Unique, Uniquable(..) )
import GHC.Data.FastString
import Data.Maybe
-import GHC.Iface.Env ( lookupOrigIO )
+import GHC.Iface.Env ( lookupNameCache )
import GHC.Prelude
import GHC.Utils.Monad ( mapMaybeM )
import GHC.ThToHs ( thRdrNameGuesses )
@@ -182,6 +182,6 @@ thNameToGhcName th_name
| Just n <- isExact_maybe rdr_name -- This happens in derived code
= return $ if isExternalName n then Just n else Nothing
| Just (rdr_mod, rdr_occ) <- isOrig_maybe rdr_name
- = do { hsc_env <- getHscEnv
- ; Just <$> liftIO (lookupOrigIO hsc_env rdr_mod rdr_occ) }
+ = do { hsc_env <- hsc_NC <$> getHscEnv
+ ; Just <$> liftIO (lookupNameCache hsc_env rdr_mod rdr_occ) }
| otherwise = return Nothing
diff --git a/compiler/GHC/Runtime/Heap/Inspect.hs b/compiler/GHC/Runtime/Heap/Inspect.hs
index 4f6e2b7057..df3cd24278 100644
--- a/compiler/GHC/Runtime/Heap/Inspect.hs
+++ b/compiler/GHC/Runtime/Heap/Inspect.hs
@@ -133,7 +133,7 @@ constrClosToName :: HscEnv -> GenClosure a -> IO (Either String Name)
constrClosToName hsc_env ConstrClosure{pkg=pkg,modl=mod,name=occ} = do
let occName = mkOccName OccName.dataName occ
modName = mkModule (stringToUnit pkg) (mkModuleName mod)
- Right `fmap` lookupOrigIO hsc_env modName occName
+ Right `fmap` lookupNameCache (hsc_NC hsc_env) modName occName
constrClosToName _hsc_env clos =
return (Left ("conClosToName: Expected ConstrClosure, got " ++ show (fmap (const ()) clos)))
diff --git a/docs/users_guide/9.4.1-notes.rst b/docs/users_guide/9.4.1-notes.rst
index 4a86970bc8..3c79de5bd8 100644
--- a/docs/users_guide/9.4.1-notes.rst
+++ b/docs/users_guide/9.4.1-notes.rst
@@ -439,6 +439,8 @@ Runtime system
datatype, to track the presence of a promotion tick. Plugins which manipulate
the Haskell AST will need to take this change into account.
+- Removed `lookupOrigIO` in favor of `lookupNameCache`
+
``ghc-heap`` library
~~~~~~~~~~~~~~~