From: simonpj Date: Thu, 14 Mar 2002 15:27:22 +0000 (+0000) Subject: [project @ 2002-03-14 15:27:15 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~2266 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=1553c7788e7f663bfc55813158325d695a21a229;p=ghc-hetmet.git [project @ 2002-03-14 15:27:15 by simonpj] ------------------------ Change GlobalName --> ExternalName LocalName -> InternalName ------------------------ For a long time there's been terminological confusion between GlobalName vs LocalName (property of a Name) GlobalId vs LocalId (property of an Id) I've now changed the terminology for Name to be ExternalName vs InternalName I've also added quite a bit of documentation in the Commentary. --- diff --git a/ghc/compiler/absCSyn/CLabel.lhs b/ghc/compiler/absCSyn/CLabel.lhs index f6037d3..b56db8d 100644 --- a/ghc/compiler/absCSyn/CLabel.lhs +++ b/ghc/compiler/absCSyn/CLabel.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CLabel.lhs,v 1.50 2001/12/12 18:12:45 sewardj Exp $ +% $Id: CLabel.lhs,v 1.51 2002/03/14 15:27:15 simonpj Exp $ % \section[CLabel]{@CLabel@: Information to make C Labels} @@ -84,7 +84,7 @@ import CStrings ( pp_cSEP ) import DataCon ( ConTag ) import Module ( moduleName, moduleNameFS, Module, isHomeModule ) -import Name ( Name, getName, isDllName, isExternallyVisibleName ) +import Name ( Name, getName, isDllName, isExternalName ) import TyCon ( TyCon ) import Unique ( pprUnique, Unique ) import PrimOp ( PrimOp ) @@ -335,7 +335,7 @@ externallyVisibleCLabel (ModuleInitLabel _)= True externallyVisibleCLabel (RtsLabel RtsModuleRegd) = False --hack externallyVisibleCLabel (RtsLabel _) = True externallyVisibleCLabel (ForeignLabel _ _) = True -externallyVisibleCLabel (IdLabel id _) = isExternallyVisibleName id +externallyVisibleCLabel (IdLabel id _) = isExternalName id externallyVisibleCLabel (CC_Label _) = False -- not strictly true externallyVisibleCLabel (CCS_Label _) = False -- not strictly true \end{code} diff --git a/ghc/compiler/basicTypes/Id.lhs b/ghc/compiler/basicTypes/Id.lhs index 52b05e1..1e4097d 100644 --- a/ghc/compiler/basicTypes/Id.lhs +++ b/ghc/compiler/basicTypes/Id.lhs @@ -101,7 +101,7 @@ import IdInfo import qualified Demand ( Demand ) import NewDemand ( Demand, StrictSig, topSig, isBottomingSig ) import Name ( Name, OccName, - mkSysLocalName, mkLocalName, + mkSystemName, mkInternalName, getOccName, getSrcLoc ) import OccName ( EncodedFS, UserFS, mkWorkerOcc ) @@ -165,8 +165,8 @@ mkVanillaGlobal :: Name -> Type -> IdInfo -> Id -- for SysLocal, we assume the base name is already encoded, to avoid -- re-encoding the same string over and over again. -mkSysLocal fs uniq ty = mkLocalId (mkSysLocalName uniq fs) ty -mkUserLocal occ uniq ty loc = mkLocalId (mkLocalName uniq occ loc) ty +mkSysLocal fs uniq ty = mkLocalId (mkSystemName uniq fs) ty +mkUserLocal occ uniq ty loc = mkLocalId (mkInternalName uniq occ loc) ty mkVanillaGlobal = mkGlobalId VanillaGlobal \end{code} @@ -180,11 +180,11 @@ mkWildId :: Type -> Id mkWildId ty = mkSysLocal FSLIT("wild") (mkBuiltinUnique 1) ty mkWorkerId :: Unique -> Id -> Type -> Id --- A worker gets a local name. CoreTidy will globalise it if necessary. +-- A worker gets a local name. CoreTidy will externalise it if necessary. mkWorkerId uniq unwrkr ty = mkLocalId wkr_name ty where - wkr_name = mkLocalName uniq (mkWorkerOcc (getOccName unwrkr)) (getSrcLoc unwrkr) + wkr_name = mkInternalName uniq (mkWorkerOcc (getOccName unwrkr)) (getSrcLoc unwrkr) -- "Template locals" typically used in unfoldings mkTemplateLocals :: [Type] -> [Id] diff --git a/ghc/compiler/basicTypes/Name.lhs b/ghc/compiler/basicTypes/Name.lhs index 79c9625..e3708ca 100644 --- a/ghc/compiler/basicTypes/Name.lhs +++ b/ghc/compiler/basicTypes/Name.lhs @@ -10,19 +10,19 @@ module Name ( -- The Name type Name, -- Abstract - mkLocalName, mkSysLocalName, mkFCallName, + mkInternalName, mkSystemName, mkFCallName, mkIPName, - mkGlobalName, mkKnownKeyGlobal, mkWiredInName, + mkExternalName, mkKnownKeyExternalName, mkWiredInName, nameUnique, setNameUnique, nameOccName, nameModule, nameModule_maybe, setNameOcc, nameRdrName, setNameModuleAndLoc, toRdrName, hashName, - globaliseName, localiseName, + externaliseName, localiseName, nameSrcLoc, - isSystemName, isLocalName, isGlobalName, isExternallyVisibleName, + isSystemName, isInternalName, isExternalName, isTyVarName, isDllName, nameIsLocalOrFrom, isHomePackageName, @@ -64,12 +64,12 @@ data Name = Name { -- the SrcLoc in a Name all that often. data NameSort - = Global Module -- (a) TyCon, Class, their derived Ids, dfun Id + = External Module -- (a) TyCon, Class, their derived Ids, dfun Id -- (b) Imported Id -- (c) Top-level Id in the original source, even if -- locally defined - | Local -- A user-defined Id or TyVar + | Internal -- A user-defined Id or TyVar -- defined in the module being compiled | System -- A system-defined Id or TyVar. Typically the @@ -78,16 +78,16 @@ data NameSort Notes about the NameSorts: -1. Initially, top-level Ids (including locally-defined ones) get Global names, - and all other local Ids get Local names +1. Initially, top-level Ids (including locally-defined ones) get External names, + and all other local Ids get Internal names -2. Things with a @Global@ name are given C static labels, so they finally +2. Things with a External name are given C static labels, so they finally appear in the .o file's symbol table. They appear in the symbol table in the form M.n. If originally-local things have this property they - must be made @Global@ first. + must be made @External@ first. -3. In the tidy-core phase, a Global that is not visible to an importer - is changed to Local, and a Local that is visible is changed to Global +3. In the tidy-core phase, a External that is not visible to an importer + is changed to Internal, and a Internal that is visible is changed to External 4. A System Name differs in the following ways: a) has unique attached when printing dumps @@ -109,31 +109,30 @@ nameUnique name = n_uniq name nameOccName name = n_occ name nameSrcLoc name = n_loc name -nameModule (Name { n_sort = Global mod }) = mod +nameModule (Name { n_sort = External mod }) = mod nameModule name = pprPanic "nameModule" (ppr name) -nameModule_maybe (Name { n_sort = Global mod }) = Just mod +nameModule_maybe (Name { n_sort = External mod }) = Just mod nameModule_maybe name = Nothing \end{code} \begin{code} -nameIsLocalOrFrom :: Module -> Name -> Bool -isLocalName :: Name -> Bool -- Not globals -isGlobalName :: Name -> Bool -isSystemName :: Name -> Bool -isExternallyVisibleName :: Name -> Bool -isHomePackageName :: Name -> Bool +nameIsLocalOrFrom :: Module -> Name -> Bool +isInternalName :: Name -> Bool +isExternalName :: Name -> Bool +isSystemName :: Name -> Bool +isHomePackageName :: Name -> Bool -isGlobalName (Name {n_sort = Global _}) = True -isGlobalName other = False +isExternalName (Name {n_sort = External _}) = True +isExternalName other = False -isLocalName name = not (isGlobalName name) +isInternalName name = not (isExternalName name) -nameIsLocalOrFrom from (Name {n_sort = Global mod}) = mod == from -nameIsLocalOrFrom from other = True +nameIsLocalOrFrom from (Name {n_sort = External mod}) = mod == from +nameIsLocalOrFrom from other = True -isHomePackageName (Name {n_sort = Global mod}) = isHomeModule mod -isHomePackageName other = True -- Local and system names +isHomePackageName (Name {n_sort = External mod}) = isHomeModule mod +isHomePackageName other = True -- Internal and system names isDllName :: Name -> Bool -- Does this name refer to something in a different DLL? isDllName nm = not opt_Static && not (isHomePackageName nm) @@ -141,11 +140,6 @@ isDllName nm = not opt_Static && not (isHomePackageName nm) isTyVarName :: Name -> Bool isTyVarName name = isTvOcc (nameOccName name) --- Global names are by definition those that are visible --- outside the module, *as seen by the linker*. Externally visible --- does not mean visible at the source level -isExternallyVisibleName name = isGlobalName name - isSystemName (Name {n_sort = System}) = True isSystemName other = False \end{code} @@ -158,8 +152,8 @@ isSystemName other = False %************************************************************************ \begin{code} -mkLocalName :: Unique -> OccName -> SrcLoc -> Name -mkLocalName uniq occ loc = Name { n_uniq = uniq, n_sort = Local, n_occ = occ, n_loc = loc } +mkInternalName :: Unique -> OccName -> SrcLoc -> Name +mkInternalName uniq occ loc = Name { n_uniq = uniq, n_sort = Internal, n_occ = occ, n_loc = loc } -- NB: You might worry that after lots of huffing and -- puffing we might end up with two local names with distinct -- uniques, but the same OccName. Indeed we can, but that's ok @@ -169,32 +163,32 @@ mkLocalName uniq occ loc = Name { n_uniq = uniq, n_sort = Local, n_occ = occ, n_ -- * for interface files we tidyCore first, which puts the uniques -- into the print name (see setNameVisibility below) -mkGlobalName :: Unique -> Module -> OccName -> SrcLoc -> Name -mkGlobalName uniq mod occ loc = Name { n_uniq = uniq, n_sort = Global mod, +mkExternalName :: Unique -> Module -> OccName -> SrcLoc -> Name +mkExternalName uniq mod occ loc = Name { n_uniq = uniq, n_sort = External mod, n_occ = occ, n_loc = loc } -mkKnownKeyGlobal :: RdrName -> Unique -> Name -mkKnownKeyGlobal rdr_name uniq - = mkGlobalName uniq (mkVanillaModule (rdrNameModule rdr_name)) +mkKnownKeyExternalName :: RdrName -> Unique -> Name +mkKnownKeyExternalName rdr_name uniq + = mkExternalName uniq (mkVanillaModule (rdrNameModule rdr_name)) (rdrNameOcc rdr_name) builtinSrcLoc mkWiredInName :: Module -> OccName -> Unique -> Name -mkWiredInName mod occ uniq = mkGlobalName uniq mod occ builtinSrcLoc +mkWiredInName mod occ uniq = mkExternalName uniq mod occ builtinSrcLoc -mkSysLocalName :: Unique -> EncodedFS -> Name -mkSysLocalName uniq fs = Name { n_uniq = uniq, n_sort = System, +mkSystemName :: Unique -> EncodedFS -> Name +mkSystemName uniq fs = Name { n_uniq = uniq, n_sort = System, n_occ = mkVarOcc fs, n_loc = noSrcLoc } mkFCallName :: Unique -> EncodedString -> Name -- The encoded string completely describes the ccall -mkFCallName uniq str = Name { n_uniq = uniq, n_sort = Local, +mkFCallName uniq str = Name { n_uniq = uniq, n_sort = Internal, n_occ = mkFCallOcc str, n_loc = noSrcLoc } mkIPName :: Unique -> OccName -> Name mkIPName uniq occ = Name { n_uniq = uniq, - n_sort = Local, + n_sort = Internal, n_occ = occ, n_loc = noSrcLoc } \end{code} @@ -208,16 +202,16 @@ setNameUnique name uniq = name {n_uniq = uniq} setNameOcc :: Name -> OccName -> Name setNameOcc name occ = name {n_occ = occ} -globaliseName :: Name -> Module -> Name -globaliseName n mod = n { n_sort = Global mod } +externaliseName :: Name -> Module -> Name +externaliseName n mod = n { n_sort = External mod } localiseName :: Name -> Name -localiseName n = n { n_sort = Local } +localiseName n = n { n_sort = Internal } setNameModuleAndLoc :: Name -> Module -> SrcLoc -> Name setNameModuleAndLoc name mod loc = name {n_sort = set (n_sort name), n_loc = loc} where - set (Global _) = Global mod + set (External _) = External mod \end{code} @@ -233,10 +227,10 @@ hashName name = iBox (u2i (nameUnique name)) nameRdrName :: Name -> RdrName --- Makes a qualified name for top-level (Global) names, whether locally defined or not --- and an unqualified name just for Locals -nameRdrName (Name { n_occ = occ, n_sort = Global mod }) = mkRdrOrig (moduleName mod) occ -nameRdrName (Name { n_occ = occ }) = mkRdrUnqual occ +-- Makes a qualified name for top-level (External) names, +-- whether locally defined or not and an unqualified name just for Internals +nameRdrName (Name { n_occ = occ, n_sort = External mod }) = mkRdrOrig (moduleName mod) occ +nameRdrName (Name { n_occ = occ }) = mkRdrUnqual occ \end{code} @@ -280,7 +274,7 @@ instance Binary Name where -- we must print these as RdrNames, because that's how they will be read in put_ bh Name {n_sort = sort, n_uniq = uniq, n_occ = occ} = case sort of - Global mod + External mod | this_mod == mod -> put_ bh (mkRdrUnqual occ) | otherwise -> put_ bh (mkRdrOrig (moduleName mod) occ) where (this_mod,_,_,_) = getUserData bh @@ -298,17 +292,17 @@ instance Binary Name where \begin{code} instance Outputable Name where - -- When printing interfaces, all Locals have been given nice print-names + -- When printing interfaces, all Internals have been given nice print-names ppr name = pprName name pprName name@(Name {n_sort = sort, n_uniq = uniq, n_occ = occ}) = getPprStyle $ \ sty -> case sort of - Global mod -> pprGlobal sty name uniq mod occ - System -> pprSysLocal sty uniq occ - Local -> pprLocal sty uniq occ + External mod -> pprExternal sty name uniq mod occ + System -> pprSystem sty uniq occ + Internal -> pprInternal sty uniq occ -pprGlobal sty name uniq mod occ +pprExternal sty name uniq mod occ | codeStyle sty = ppr (moduleName mod) <> char '_' <> pprOccName occ | debugStyle sty = ppr (moduleName mod) <> dot <> pprOccName occ <> @@ -317,14 +311,14 @@ pprGlobal sty name uniq mod occ | unqualStyle sty name = pprOccName occ | otherwise = ppr (moduleName mod) <> dot <> pprOccName occ -pprLocal sty uniq occ +pprInternal sty uniq occ | codeStyle sty = pprUnique uniq | debugStyle sty = pprOccName occ <> text "{-" <> pprUnique uniq <> text "-}" | otherwise = pprOccName occ -- User and Iface styles --- Like Local, except that we only omit the unique in Iface style -pprSysLocal sty uniq occ +-- Like Internal, except that we only omit the unique in Iface style +pprSystem sty uniq occ | codeStyle sty = pprUnique uniq | ifaceStyle sty = pprOccName occ -- The tidy phase has ensured -- that OccNames are enough diff --git a/ghc/compiler/basicTypes/Var.lhs b/ghc/compiler/basicTypes/Var.lhs index 27487ba..deff82a 100644 --- a/ghc/compiler/basicTypes/Var.lhs +++ b/ghc/compiler/basicTypes/Var.lhs @@ -41,7 +41,7 @@ import {-# SOURCE #-} IdInfo( GlobalIdDetails, notGlobalId, import Name ( Name, OccName, NamedThing(..), setNameUnique, setNameOcc, nameUnique, - mkSysLocalName + mkSystemName ) import Unique ( Unique, Uniquable(..), mkUniqueGrimily, getKey ) import FastTypes @@ -195,7 +195,7 @@ mkSysTyVar uniq kind = Var { varName = name , varInfo = pprPanic "mkSysTyVar" (ppr name) } where - name = mkSysLocalName uniq FSLIT("t") + name = mkSystemName uniq FSLIT("t") newMutTyVar :: Name -> Kind -> TyVarDetails -> IO TyVar newMutTyVar name kind details diff --git a/ghc/compiler/codeGen/CgBindery.lhs b/ghc/compiler/codeGen/CgBindery.lhs index 7414569..acac740 100644 --- a/ghc/compiler/codeGen/CgBindery.lhs +++ b/ghc/compiler/codeGen/CgBindery.lhs @@ -44,7 +44,7 @@ import VarEnv import VarSet ( varSetElems ) import Literal ( Literal ) import Maybes ( catMaybes, maybeToBool, seqMaybe ) -import Name ( isLocalName, NamedThing(..) ) +import Name ( isInternalName, NamedThing(..) ) #ifdef DEBUG import PprAbsC ( pprAmode ) #endif @@ -259,7 +259,7 @@ getCAddrModeAndInfo id case maybe_cg_id_info of -- Nothing => not in the environment, so should be imported - Nothing | isLocalName name -> cgLookupPanic id + Nothing | isInternalName name -> cgLookupPanic id | otherwise -> returnFC (id, global_amode, mkLFImported id) Just (MkCgIdInfo id' volatile_loc stable_loc lf_info) diff --git a/ghc/compiler/codeGen/CgClosure.lhs b/ghc/compiler/codeGen/CgClosure.lhs index 051a0eb..e7d70e4f 100644 --- a/ghc/compiler/codeGen/CgClosure.lhs +++ b/ghc/compiler/codeGen/CgClosure.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgClosure.lhs,v 1.55 2002/02/14 11:56:03 njn Exp $ +% $Id: CgClosure.lhs,v 1.56 2002/03/14 15:27:17 simonpj Exp $ % \section[CgClosure]{Code generation for closures} @@ -46,7 +46,7 @@ import ClosureInfo -- lots and lots of stuff import CmdLineOpts ( opt_GranMacros, opt_SccProfilingOn, opt_DoTickyProfiling ) import CostCentre import Id ( Id, idName, idType, idPrimRep ) -import Name ( Name, isLocalName ) +import Name ( Name, isInternalName ) import Module ( Module, pprModule ) import ListSetOps ( minusList ) import PrimRep ( PrimRep(..) ) @@ -449,7 +449,7 @@ closureCodeBody binder_info closure_info cc all_args body -- give the module name even for *local* things. We print -- just "x (M)" rather that "M.x" to distinguish them from the global kind. ppr_for_ticky_name mod_name name - | isLocalName name = showSDocDebug (ppr name <+> (parens (ppr mod_name))) + | isInternalName name = showSDocDebug (ppr name <+> (parens (ppr mod_name))) | otherwise = showSDocDebug (ppr name) \end{code} diff --git a/ghc/compiler/codeGen/CgTailCall.lhs b/ghc/compiler/codeGen/CgTailCall.lhs index 8dfd5f4..73e7aaa 100644 --- a/ghc/compiler/codeGen/CgTailCall.lhs +++ b/ghc/compiler/codeGen/CgTailCall.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgTailCall.lhs,v 1.31 2001/10/25 05:07:32 sof Exp $ +% $Id: CgTailCall.lhs,v 1.32 2002/03/14 15:27:17 simonpj Exp $ % %******************************************************** %* * @@ -345,7 +345,7 @@ tailCallFun tailCallFun fun fun_amode lf_info arg_amodes pending_assts = nodeMustPointToIt lf_info `thenFC` \ node_points -> -- we use the name of fun', the Id from the environment, rather than - -- fun from the STG tree, in case it is a top-level name that we globalised + -- fun from the STG tree, in case it is a top-level name that we externalised -- (see cgTopRhsClosure). getEntryConvention (idName fun) lf_info (map getAmodeRep arg_amodes) `thenFC` \ entry_conv -> diff --git a/ghc/compiler/codeGen/CodeGen.lhs b/ghc/compiler/codeGen/CodeGen.lhs index b7f01cb..5d08357 100644 --- a/ghc/compiler/codeGen/CodeGen.lhs +++ b/ghc/compiler/codeGen/CodeGen.lhs @@ -40,7 +40,7 @@ import CmdLineOpts ( DynFlags, DynFlag(..), opt_SccProfilingOn, opt_EnsureSplittableC ) import CostCentre ( CollectedCCs ) import Id ( Id, idName, setIdName ) -import Name ( nameSrcLoc, nameOccName, nameUnique, isLocalName, mkGlobalName ) +import Name ( nameSrcLoc, nameOccName, nameUnique, isInternalName, mkExternalName ) import OccName ( mkLocalOcc ) import Module ( Module ) import PrimRep ( PrimRep(..) ) @@ -182,14 +182,14 @@ variable. cgTopBinding :: (StgBinding,[Id]) -> Code cgTopBinding (StgNonRec srt_info id rhs, srt) = absC maybeSplitCode `thenC` - maybeGlobaliseId id `thenFC` \ id' -> + maybeExternaliseId id `thenFC` \ id' -> let srt_label = mkSRTLabel (idName id') in mkSRT srt_label srt [] `thenC` setSRTLabel srt_label ( cgTopRhs id' rhs srt_info `thenFC` \ (id, info) -> - addBindC id info -- Add the un-globalised Id to the envt, so we + addBindC id info -- Add the un-externalised Id to the envt, so we -- find it when we look up occurrences ) @@ -198,7 +198,7 @@ cgTopBinding (StgRec srt_info pairs, srt) let (bndrs, rhss) = unzip pairs in - mapFCs maybeGlobaliseId bndrs `thenFC` \ bndrs'@(id:_) -> + mapFCs maybeExternaliseId bndrs `thenFC` \ bndrs'@(id:_) -> let srt_label = mkSRTLabel (idName id) pairs' = zip bndrs' rhss @@ -218,7 +218,7 @@ mkSRT lbl ids these absC (CSRT lbl (map (mkClosureLabel . idName) ids)) where -- sigh, better map all the ids against the environment in case they've - -- been globalised (see maybeGlobaliseId below). + -- been externalised (see maybeExternaliseId below). remap id = case filter (==id) these of [] -> getCAddrModeAndInfo id `thenFC` \ (id, _, _) -> returnFC id @@ -230,7 +230,7 @@ mkSRT lbl ids these cgTopRhs :: Id -> StgRhs -> SRT -> FCode (Id, CgIdInfo) -- The Id is passed along for setting up a binding... - -- It's already been globalised if necessary + -- It's already been externalised if necessary cgTopRhs bndr (StgRhsCon cc con args) srt = forkStatics (cgTopRhsCon bndr con args srt) @@ -250,17 +250,17 @@ cgTopRhs bndr (StgRhsClosure cc bi fvs upd_flag args body) srt %* * %************************************************************************ -If we're splitting the object, we need to globalise all the top-level names -(and then make sure we only use the globalised one in any C label we use +If we're splitting the object, we need to externalise all the top-level names +(and then make sure we only use the externalised one in any C label we use which refers to this name). \begin{code} -maybeGlobaliseId :: Id -> FCode Id -maybeGlobaliseId id - | opt_EnsureSplittableC, -- Globalise the name for -split-objs - isLocalName name +maybeExternaliseId :: Id -> FCode Id +maybeExternaliseId id + | opt_EnsureSplittableC, -- Externalise the name for -split-objs + isInternalName name = moduleName `thenFC` \ mod -> - returnFC (setIdName id (mkGlobalName uniq mod new_occ (nameSrcLoc name))) + returnFC (setIdName id (mkExternalName uniq mod new_occ (nameSrcLoc name))) | otherwise = returnFC id where diff --git a/ghc/compiler/compMan/CompManager.lhs b/ghc/compiler/compMan/CompManager.lhs index 2e56d37..dea4136 100644 --- a/ghc/compiler/compMan/CompManager.lhs +++ b/ghc/compiler/compMan/CompManager.lhs @@ -75,7 +75,7 @@ import HscMain ( initPersistentCompilerState ) #endif import HscTypes import Name ( Name, NamedThing(..), nameRdrName, nameModule, - isHomePackageName, isGlobalName ) + isHomePackageName, isExternalName ) import NameEnv import Rename ( mkGlobalContext ) import RdrName ( emptyRdrEnv ) @@ -253,7 +253,7 @@ cmInfoThing cmstate dflags id getFixity :: PersistentCompilerState -> Name -> Fixity getFixity pcs name - | isGlobalName name, + | isExternalName name, Just iface <- lookupModuleEnv iface_table (nameModule name), Just fixity <- lookupNameEnv (mi_fixities iface) name = fixity diff --git a/ghc/compiler/coreSyn/CoreTidy.lhs b/ghc/compiler/coreSyn/CoreTidy.lhs index b0dfbd3..72236c9 100644 --- a/ghc/compiler/coreSyn/CoreTidy.lhs +++ b/ghc/compiler/coreSyn/CoreTidy.lhs @@ -29,8 +29,8 @@ import Id ( idType, idInfo, idName, isExportedId, import IdInfo {- loads of stuff -} import NewDemand ( isBottomingSig, topSig ) import BasicTypes ( isNeverActive ) -import Name ( getOccName, nameOccName, mkLocalName, mkGlobalName, - localiseName, isGlobalName, nameSrcLoc +import Name ( getOccName, nameOccName, mkInternalName, mkExternalName, + localiseName, isExternalName, nameSrcLoc ) import NameEnv ( filterNameEnv ) import OccName ( TidyOccEnv, initTidyOccEnv, tidyOccName ) @@ -157,7 +157,7 @@ tidyCorePgm dflags mod pcs cg_info_env init_tidy_env = (orig_ns, initTidyOccEnv avoids, emptyVarEnv) avoids = [getOccName name | bndr <- typeEnvIds env_tc, let name = idName bndr, - isGlobalName name] + isExternalName name] -- In computing our "avoids" list, we must include -- all implicit Ids -- all things with global names (assigned once and for @@ -177,7 +177,7 @@ tidyCorePgm dflags mod pcs cg_info_env ; let final_ids = [ id | bind <- tidy_binds , id <- bindersOf bind - , isGlobalName (idName id)] + , isExternalName (idName id)] -- Dfuns are local Ids that might have -- changed their unique during tidying @@ -518,7 +518,7 @@ tidyTopIdInfo tidy_env is_external idinfo unfold_info arity cg_info -- This is where we set names to local/global based on whether they really are -- externally visible (see comment at the top of this module). If the name -- was previously local, we have to give it a unique occurrence name if --- we intend to globalise it. +-- we intend to externalise it. tidyTopName mod ns occ_env external name | global && internal = (ns, occ_env, localiseName name) @@ -529,22 +529,22 @@ tidyTopName mod ns occ_env external name | local && internal = (ns_w_local, occ_env', new_local_name) -- Even local, internal names must get a unique occurrence, because - -- if we do -split-objs we globalise the name later, in the code generator + -- if we do -split-objs we externalise the name later, in the code generator -- -- Similarly, we must make sure it has a system-wide Unique, because -- the byte-code generator builds a system-wide Name->BCO symbol table | local && external = case lookupFM ns_names key of Just orig -> (ns, occ_env', orig) - Nothing -> (ns_w_global, occ_env', new_global_name) - -- If we want to globalise a currently-local name, check + Nothing -> (ns_w_global, occ_env', new_external_name) + -- If we want to externalise a currently-local name, check -- whether we have already assigned a unique for it. -- If so, use it; if not, extend the table (ns_w_global). -- This is needed when *re*-compiling a module in GHCi; we want to -- use the same name for externally-visible things as we did before. where - global = isGlobalName name + global = isExternalName name local = not global internal = not external @@ -556,11 +556,11 @@ tidyTopName mod ns occ_env external name uniq = uniqFromSupply us1 loc = nameSrcLoc name - new_local_name = mkLocalName uniq occ' loc - new_global_name = mkGlobalName uniq mod occ' loc + new_local_name = mkInternalName uniq occ' loc + new_external_name = mkExternalName uniq mod occ' loc ns_w_local = ns { nsUniqs = us2 } - ns_w_global = ns { nsUniqs = us2, nsNames = addToFM ns_names key new_global_name } + ns_w_global = ns { nsUniqs = us2, nsNames = addToFM ns_names key new_external_name } ------------ Worker -------------- diff --git a/ghc/compiler/deSugar/Check.lhs b/ghc/compiler/deSugar/Check.lhs index d445834..4f134eb 100644 --- a/ghc/compiler/deSugar/Check.lhs +++ b/ghc/compiler/deSugar/Check.lhs @@ -19,7 +19,7 @@ import DsUtils ( EquationInfo(..), MatchResult(..), EqnSet, import Id ( idType ) import DataCon ( DataCon, dataConTyCon, dataConArgTys, dataConSourceArity, dataConFieldLabels ) -import Name ( Name, mkLocalName, getOccName, isDataSymOcc, getName, mkVarOcc ) +import Name ( Name, mkInternalName, getOccName, isDataSymOcc, getName, mkVarOcc ) import TcType ( mkTyVarTys ) import TysPrim ( charPrimTy ) import TysWiredIn @@ -375,7 +375,7 @@ make_row_vars used_lits (EqnInfo _ _ pats _ ) = (VarPatIn new_var:takeList (tail pats) (repeat new_wild_pat),[(new_var,used_lits)]) where new_var = hash_x -hash_x = mkLocalName unboundKey {- doesn't matter much -} +hash_x = mkInternalName unboundKey {- doesn't matter much -} (mkVarOcc SLIT("#x")) noSrcLoc diff --git a/ghc/compiler/ghci/ByteCodeLink.lhs b/ghc/compiler/ghci/ByteCodeLink.lhs index 2779a59..ff7557d 100644 --- a/ghc/compiler/ghci/ByteCodeLink.lhs +++ b/ghc/compiler/ghci/ByteCodeLink.lhs @@ -16,7 +16,7 @@ module ByteCodeLink ( UnlinkedBCO, UnlinkedBCOExpr, assembleBCO, #include "HsVersions.h" import Outputable -import Name ( Name, getName, nameModule, toRdrName, isGlobalName ) +import Name ( Name, getName, nameModule, toRdrName, isExternalName ) import RdrName ( rdrNameOcc, rdrNameModule ) import OccName ( occNameString ) import FiniteMap ( FiniteMap, addListToFM, filterFM, @@ -103,7 +103,7 @@ linkSomeBCOs toplevs_only ie ce_in ul_bcos in mapM (linkBCO ie ce_out) ul_bcos ) let ce_all_additions = zip nms hvals - ce_top_additions = filter (isGlobalName.fst) ce_all_additions + ce_top_additions = filter (isExternalName.fst) ce_all_additions ce_additions = if toplevs_only then ce_top_additions else ce_all_additions ce_out = -- make sure we're not inserting duplicate names into the @@ -153,7 +153,7 @@ data HValue = HValue -- dummy type, actually a pointer to some Real Code. -- the command line). filterNameMap :: [ModuleName] -> FiniteMap Name a -> FiniteMap Name a filterNameMap mods env - = filterFM (\n _ -> isGlobalName n + = filterFM (\n _ -> isExternalName n && moduleName (nameModule n) `elem` mods) env \end{code} @@ -603,7 +603,7 @@ lookupCE ce (Left nm) = case lookupFM ce nm of Just aa -> return aa Nothing - -> ASSERT2(isGlobalName nm, ppr nm) + -> ASSERT2(isExternalName nm, ppr nm) do let sym_to_find = nameToCLabel nm "closure" m <- lookupSymbol sym_to_find case m of diff --git a/ghc/compiler/hsSyn/HsDecls.lhs b/ghc/compiler/hsSyn/HsDecls.lhs index b4d98cf..9160f4a 100644 --- a/ghc/compiler/hsSyn/HsDecls.lhs +++ b/ghc/compiler/hsSyn/HsDecls.lhs @@ -238,7 +238,7 @@ Source code: instance Foo [Bool] where ... These might both be dFooList - - The CoreTidy phase globalises the name, and ensures the occurrence name is + - The CoreTidy phase externalises the name, and ensures the occurrence name is unique (this isn't special to dict funs). So we'd get dFooList and dFooList1. - We can take this relaxed approach (changing the occurrence name later) diff --git a/ghc/compiler/ilxGen/IlxGen.lhs b/ghc/compiler/ilxGen/IlxGen.lhs index e43a21c..3f1cdd9 100644 --- a/ghc/compiler/ilxGen/IlxGen.lhs +++ b/ghc/compiler/ilxGen/IlxGen.lhs @@ -27,7 +27,7 @@ import PrimOp ( PrimOp(..) ) import ForeignCall ( CCallConv(..), ForeignCall(..), CCallSpec(..), CCallTarget(..), DNCallSpec(..) ) import TysWiredIn ( mkTupleTy, tupleCon ) import PrimRep ( PrimRep(..) ) -import Name ( nameModule, nameOccName, isGlobalName, isLocalName, NamedThing(getName) ) +import Name ( nameModule, nameOccName, isExternalName, isInternalName, NamedThing(getName) ) import Subst ( substTyWith ) import Module ( Module, PackageName, ModuleName, moduleName, @@ -157,7 +157,7 @@ importsVars env vs = foldR (importsVar env) vs importsVar env v = importsName env (idName v). importsType env (idType v) importsName env n - | isLocalName n = importsNone + | isInternalName n = importsNone | ilxEnvModule env == nameModule n = importsNone | isHomeModule (nameModule n) = addModuleImpInfo (moduleName (nameModule n)) -- See HACK below @@ -187,7 +187,7 @@ importsTypeArgs2 env tys = foldR (importsType2 env) tys importsDataCon env dcon = importsTyCon env (dataConTyCon dcon) importsTyCon env tc | (not (isDataTyCon tc) || - isLocalName (getName tc) || + isInternalName (getName tc) || ilxEnvModule env == nameModule (getName tc)) = importsNone importsTyCon env tc | otherwise = importsName env (getName tc) . addTyConImpInfo tc . foldR (importsTyConDataCon env) (tyConDataCons tc) @@ -210,7 +210,7 @@ importsTyConDataConType2 _ _ = panic "IlxGen.lhs: importsTyConDataConType2 ty" importsTyConDataConTypeArgs2 env tys = foldR (importsTyConDataConType2 env) tys importsTyConDataConTypeTyCon env tc | (not (isDataTyCon tc) || - isLocalName (getName tc) || + isInternalName (getName tc) || ilxEnvModule env == nameModule (getName tc)) = importsNone importsTyConDataConTypeTyCon env tc | otherwise = importsName env (getName tc) @@ -1124,7 +1124,7 @@ pushLit env (MachAddr w) = text "ldc.i4" <+> integer w <+> text "conv.i" pushLit env (MachLabel l) = trace "WARNING: Cannot compile MachLabel to ILX in IlxGen.lhs" (text "// MachLabel!!! Not valid in ILX!!") pprIlxTopVar env v - | isGlobalName n = (nameReference env n) <> pprId (nameModule n) <> text "::" <> singleQuotes (ppr (nameModule n) <> text "_" <> ppr (nameOccName n)) + | isExternalName n = (nameReference env n) <> pprId (nameModule n) <> text "::" <> singleQuotes (ppr (nameModule n) <> text "_" <> ppr (nameOccName n)) | otherwise = pprId (nameOccName n) where n = idName v @@ -1458,7 +1458,7 @@ line = text "// ----------------------------------" hscOptionQual = text ".i_" nameReference env n - | isLocalName n = empty + | isInternalName n = empty | ilxEnvModule env == nameModule n = text "" | isHomeModule (nameModule n) = moduleNameReference (moduleName (nameModule n)) -- HACK: no Vanilla modules should be around, but they are!! This diff --git a/ghc/compiler/javaGen/JavaGen.lhs b/ghc/compiler/javaGen/JavaGen.lhs index 9b5bcba..b6fbc36 100644 --- a/ghc/compiler/javaGen/JavaGen.lhs +++ b/ghc/compiler/javaGen/JavaGen.lhs @@ -49,7 +49,7 @@ import Java import Literal ( Literal(..) ) import Id ( Id, isDataConId_maybe, isId, idName, isDeadBinder, idPrimRep , isPrimOpId_maybe ) -import Name ( NamedThing(..), getOccString, isGlobalName, isLocalName +import Name ( NamedThing(..), getOccString, isExternalName, isInternalName , nameModule ) import PrimRep ( PrimRep(..) ) import DataCon ( DataCon, dataConRepArity, dataConRepArgTys, dataConId ) @@ -220,7 +220,7 @@ java_top_bind bndr rhs \begin{code} javaVar :: Id -> Expr -javaVar v | isGlobalName (idName v) = mkNew (javaIdType v) [] +javaVar v | isExternalName (idName v) = mkNew (javaIdType v) [] | otherwise = Var (javaName v) javaLit :: Literal.Literal -> Expr @@ -724,7 +724,7 @@ withType (Name n _) t = Name n t -- using the same string as the Id. javaName :: Id -> Name javaName n - | isGlobalName (idName n) = error "useing javaName on global" + | isExternalName (idName n) = error "useing javaName on global" | otherwise = Name (getOccString n) (primRepToType (idPrimRep n)) @@ -734,7 +734,7 @@ javaName n javaIdTypeName :: Id -> TypeName javaIdTypeName n - | isLocalName n' = renameForKeywords n' + | isInternalName n' = renameForKeywords n' | otherwise = moduleString (nameModule n') ++ "." ++ renameForKeywords n' where n' = getName n diff --git a/ghc/compiler/main/HscMain.lhs b/ghc/compiler/main/HscMain.lhs index 8e82ede..f6faffe 100644 --- a/ghc/compiler/main/HscMain.lhs +++ b/ghc/compiler/main/HscMain.lhs @@ -26,7 +26,7 @@ import OccName ( dataName, tcClsName, import Type ( Type ) import Id ( Id, idName, setGlobalIdDetails ) import IdInfo ( GlobalIdDetails(VanillaGlobal) ) -import Name ( isLocalName ) +import Name ( isInternalName ) import NameEnv ( lookupNameEnv ) import Module ( lookupModuleEnv ) import RdrName ( rdrEnvElts ) @@ -673,7 +673,7 @@ hscThing dflags hst hit pcs0 ic str Nothing -> return (pcs, []); Just pcs -> let do_lookup n - | isLocalName n = lookupNameEnv (ic_type_env ic) n + | isInternalName n = lookupNameEnv (ic_type_env ic) n | otherwise = lookupType hst (pcs_PTE pcs) n maybe_ty_things = map do_lookup names diff --git a/ghc/compiler/main/MkIface.lhs b/ghc/compiler/main/MkIface.lhs index fc7de58..549d2af 100644 --- a/ghc/compiler/main/MkIface.lhs +++ b/ghc/compiler/main/MkIface.lhs @@ -45,7 +45,7 @@ import CoreSyn ( CoreRule(..), IdCoreRule ) import CoreFVs ( ruleLhsFreeNames ) import CoreUnfold ( neverUnfold, unfoldingTemplate ) import PprCore ( pprIdCoreRule ) -import Name ( getName, nameModule, toRdrName, isGlobalName, +import Name ( getName, nameModule, toRdrName, isExternalName, nameIsLocalOrFrom, Name, NamedThing(..) ) import NameEnv import NameSet @@ -513,10 +513,10 @@ dump_types dfun_ids type_env ids = [id | id <- typeEnvIds type_env, want_sig id] want_sig id | opt_PprStyle_Debug = True | otherwise = isLocalId id && - isGlobalName (idName id) && + isExternalName (idName id) && not (id `elem` dfun_ids) -- isLocalId ignores data constructors, records selectors etc - -- The isGlobalName ignores local dictionary and method bindings + -- The isExternalName ignores local dictionary and method bindings -- that the type checker has invented. User-defined things have -- Global names. diff --git a/ghc/compiler/prelude/PrelNames.lhs b/ghc/compiler/prelude/PrelNames.lhs index f83e04a..c0cfc0a 100644 --- a/ghc/compiler/prelude/PrelNames.lhs +++ b/ghc/compiler/prelude/PrelNames.lhs @@ -49,7 +49,7 @@ import Unique ( Unique, Uniquable(..), hasKey, ) import BasicTypes ( Boxity(..), Arity ) import UniqFM ( UniqFM, listToUFM ) -import Name ( Name, mkLocalName, mkKnownKeyGlobal, nameRdrName ) +import Name ( Name, mkInternalName, mkKnownKeyExternalName, nameRdrName ) import RdrName ( rdrNameOcc ) import SrcLoc ( builtinSrcLoc, noSrcLoc ) import Util ( nOfThem ) @@ -66,14 +66,14 @@ import Panic ( panic ) This *local* name is used by the interactive stuff \begin{code} -itName uniq = mkLocalName uniq (mkOccFS varName FSLIT("it")) noSrcLoc +itName uniq = mkInternalName uniq (mkOccFS varName FSLIT("it")) noSrcLoc \end{code} \begin{code} -- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly -- during compiler debugging. mkUnboundName :: RdrName -> Name -mkUnboundName rdr_name = mkLocalName unboundKey (rdrNameOcc rdr_name) builtinSrcLoc +mkUnboundName rdr_name = mkInternalName unboundKey (rdrNameOcc rdr_name) builtinSrcLoc isUnboundName :: Name -> Bool isUnboundName name = name `hasKey` unboundKey @@ -690,12 +690,12 @@ minus_RDR = nameRdrName minusName All these are original names; hence mkOrig \begin{code} -varQual mod str uq = mkKnownKeyGlobal (varQual_RDR mod str) uq -dataQual mod str uq = mkKnownKeyGlobal (dataQual_RDR mod str) uq -tcQual mod str uq = mkKnownKeyGlobal (tcQual_RDR mod str) uq -clsQual mod str uq = mkKnownKeyGlobal (clsQual_RDR mod str) uq +varQual mod str uq = mkKnownKeyExternalName (varQual_RDR mod str) uq +dataQual mod str uq = mkKnownKeyExternalName (dataQual_RDR mod str) uq +tcQual mod str uq = mkKnownKeyExternalName (tcQual_RDR mod str) uq +clsQual mod str uq = mkKnownKeyExternalName (clsQual_RDR mod str) uq -kindQual str uq = mkLocalName uq (mkKindOccFS tcName str) builtinSrcLoc +kindQual str uq = mkInternalName uq (mkKindOccFS tcName str) builtinSrcLoc -- Kinds are not z-encoded in interface file, hence mkKindOccFS -- And they don't come from any particular module; indeed we always -- want to print them unqualified. Hence the LocalName diff --git a/ghc/compiler/prelude/TysPrim.lhs b/ghc/compiler/prelude/TysPrim.lhs index a0770af..df43faf 100644 --- a/ghc/compiler/prelude/TysPrim.lhs +++ b/ghc/compiler/prelude/TysPrim.lhs @@ -50,7 +50,7 @@ module TysPrim( #include "HsVersions.h" import Var ( TyVar, mkTyVar ) -import Name ( Name, mkLocalName ) +import Name ( Name, mkInternalName ) import OccName ( mkVarOcc ) import PrimRep ( PrimRep(..) ) import TyCon ( TyCon, ArgVrcs, mkPrimTyCon, mkLiftedPrimTyCon ) @@ -115,7 +115,7 @@ alphaTyVars is a list of type variables for use in templates: \begin{code} tyVarList :: Kind -> [TyVar] -tyVarList kind = [ mkTyVar (mkLocalName (mkAlphaTyVarUnique u) +tyVarList kind = [ mkTyVar (mkInternalName (mkAlphaTyVarUnique u) (mkVarOcc (mkFastString name)) noSrcLoc) kind | u <- [2..], diff --git a/ghc/compiler/rename/Rename.lhs b/ghc/compiler/rename/Rename.lhs index cc80388..d9a4dcb 100644 --- a/ghc/compiler/rename/Rename.lhs +++ b/ghc/compiler/rename/Rename.lhs @@ -46,7 +46,7 @@ import Module ( Module, ModuleName, WhereFrom(..), moduleNameUserString, moduleName, moduleEnvElts ) -import Name ( Name, nameModule, isGlobalName ) +import Name ( Name, nameModule, isExternalName ) import NameEnv import NameSet import RdrName ( foldRdrEnv, isQual ) @@ -422,10 +422,10 @@ rename ghci_mode this_module -- simplification), and retain them all in the TypeEnv so they are -- available from the command line. -- - -- isGlobalName separates the user-defined top-level names from those + -- isExternalName separates the user-defined top-level names from those -- introduced by the type checker. dont_discard :: Name -> Bool - dont_discard | ghci_mode == Interactive = isGlobalName + dont_discard | ghci_mode == Interactive = isExternalName | otherwise = (`elemNameSet` exported_names) exported_names = availsToNameSet export_avails diff --git a/ghc/compiler/rename/RnEnv.lhs b/ghc/compiler/rename/RnEnv.lhs index d12aab9..4c742f3 100644 --- a/ghc/compiler/rename/RnEnv.lhs +++ b/ghc/compiler/rename/RnEnv.lhs @@ -29,7 +29,7 @@ import HscTypes ( Provenance(..), pprNameProvenance, hasBetterProv, import RnMonad import Name ( Name, getSrcLoc, nameIsLocalOrFrom, - mkLocalName, mkGlobalName, + mkInternalName, mkExternalName, mkIPName, nameOccName, nameModule_maybe, setNameModuleAndLoc ) @@ -118,7 +118,7 @@ newTopBinder mod rdr_name loc Nothing -> let (us', us1) = splitUniqSupply (nsUniqs name_supply) uniq = uniqFromSupply us1 - new_name = mkGlobalName uniq mod occ loc + new_name = mkExternalName uniq mod occ loc new_cache = addToFM cache key new_name in setNameSupplyRn (name_supply {nsUniqs = us', nsNames = new_cache}) `thenRn_` @@ -161,7 +161,7 @@ newGlobalName mod_name occ (us', us1) = splitUniqSupply (nsUniqs name_supply) uniq = uniqFromSupply us1 mod = mkVanillaModule mod_name - name = mkGlobalName uniq mod occ noSrcLoc + name = mkExternalName uniq mod occ noSrcLoc new_cache = addToFM cache key name newIPName rdr_name_ip @@ -528,7 +528,7 @@ newLocalsRn rdr_names_w_loc let (us', us1) = splitUniqSupply (nsUniqs name_supply) uniqs = uniqsFromSupply us1 - names = [ mkLocalName uniq (rdrNameOcc rdr_name) loc + names = [ mkInternalName uniq (rdrNameOcc rdr_name) loc | ((rdr_name,loc), uniq) <- rdr_names_w_loc `zip` uniqs ] in @@ -584,7 +584,7 @@ bindCoreLocalRn rdr_name enclosed_scope let (us', us1) = splitUniqSupply (nsUniqs name_supply) uniq = uniqFromSupply us1 - name = mkLocalName uniq (rdrNameOcc rdr_name) loc + name = mkInternalName uniq (rdrNameOcc rdr_name) loc in setNameSupplyRn (name_supply {nsUniqs = us'}) `thenRn_` let diff --git a/ghc/compiler/rename/RnExpr.lhs b/ghc/compiler/rename/RnExpr.lhs index 136ad85..74381a1 100644 --- a/ghc/compiler/rename/RnExpr.lhs +++ b/ghc/compiler/rename/RnExpr.lhs @@ -44,7 +44,7 @@ import PrelNames ( hasKey, assertIdKey, import TysPrim ( charPrimTyCon, addrPrimTyCon, intPrimTyCon, floatPrimTyCon, doublePrimTyCon ) import TysWiredIn ( intTyCon ) -import Name ( NamedThing(..), mkSysLocalName, nameSrcLoc ) +import Name ( NamedThing(..), mkSystemName, nameSrcLoc ) import NameSet import UniqFM ( isNullUFM ) import UniqSet ( emptyUniqSet ) @@ -906,7 +906,7 @@ mkAssertExpr = if opt_IgnoreAsserts then getUniqRn `thenRn` \ uniq -> let - vname = mkSysLocalName uniq FSLIT("v") + vname = mkSystemName uniq FSLIT("v") expr = HsLam ignorePredMatch loc = nameSrcLoc vname ignorePredMatch = mkSimpleMatch [WildPatIn, VarPatIn vname] (HsVar vname) placeHolderType loc diff --git a/ghc/compiler/rename/RnHiFiles.lhs b/ghc/compiler/rename/RnHiFiles.lhs index 586f653..8d674a5 100644 --- a/ghc/compiler/rename/RnHiFiles.lhs +++ b/ghc/compiler/rename/RnHiFiles.lhs @@ -41,7 +41,7 @@ import ParseIface ( parseIface ) import PrelNames ( gHC_PRIM_Name, gHC_PRIM ) import Name ( Name {-instance NamedThing-}, - nameModule, isLocalName, nameIsLocalOrFrom + nameModule, isInternalName, nameIsLocalOrFrom ) import NameEnv import NameSet @@ -80,7 +80,7 @@ import List ( isSuffixOf ) \begin{code} loadHomeInterface :: SDoc -> Name -> RnM d ModIface loadHomeInterface doc_str name - = ASSERT2( not (isLocalName name), ppr name <+> parens doc_str ) + = ASSERT2( not (isInternalName name), ppr name <+> parens doc_str ) loadInterface doc_str (moduleName (nameModule name)) ImportBySystem loadOrphanModules :: [ModuleName] -> RnM d () diff --git a/ghc/compiler/rename/RnIfaces.lhs b/ghc/compiler/rename/RnIfaces.lhs index ba2b1cd..076e73b 100644 --- a/ghc/compiler/rename/RnIfaces.lhs +++ b/ghc/compiler/rename/RnIfaces.lhs @@ -42,7 +42,7 @@ import DataCon ( dataConTyCon ) import TyCon ( visibleDataCons, isSynTyCon, getSynTyConDefn, tyConClass_maybe, tyConName ) import Class ( className ) import Name ( Name {-instance NamedThing-}, nameOccName, - nameModule, isLocalName, NamedThing(..) + nameModule, isInternalName, NamedThing(..) ) import NameEnv ( elemNameEnv, delFromNameEnv, lookupNameEnv ) import NameSet @@ -380,7 +380,7 @@ recordDeclSlurp ifaces@(Ifaces { iDecls = (decls_map, n_slurped), iSlurp = slurped_names, iVSlurp = vslurp }) avail - = ASSERT2( not (isLocalName (availName avail)), ppr avail ) + = ASSERT2( not (isInternalName (availName avail)), ppr avail ) ifaces { iDecls = (new_decls_map, n_slurped+1), iSlurp = new_slurped_names, iVSlurp = updateVSlurp vslurp (availName avail) } diff --git a/ghc/compiler/rename/RnMonad.lhs b/ghc/compiler/rename/RnMonad.lhs index 4c33362..966e1bc 100644 --- a/ghc/compiler/rename/RnMonad.lhs +++ b/ghc/compiler/rename/RnMonad.lhs @@ -49,7 +49,7 @@ import Id ( idName ) import MkId ( seqId ) import Name ( Name, OccName, NamedThing(..), nameOccName, nameRdrName, - decode, mkLocalName, mkKnownKeyGlobal + decode, mkInternalName ) import NameEnv ( NameEnv, lookupNameEnv, emptyNameEnv, extendNameEnvList ) diff --git a/ghc/compiler/stgSyn/CoreToStg.lhs b/ghc/compiler/stgSyn/CoreToStg.lhs index 38c9c4d..1db8794 100644 --- a/ghc/compiler/stgSyn/CoreToStg.lhs +++ b/ghc/compiler/stgSyn/CoreToStg.lhs @@ -30,7 +30,7 @@ import VarSet import VarEnv import DataCon ( dataConWrapId ) import Maybes ( maybeToBool ) -import Name ( getOccName, isExternallyVisibleName, isDllName ) +import Name ( getOccName, isExternalName, isDllName ) import OccName ( occNameUserString ) import BasicTypes ( TopLevelFlag(..), isNotTopLevel, Arity ) import CmdLineOpts ( DynFlags, opt_RuntimeTypes ) @@ -991,7 +991,7 @@ lookupFVInfo :: FreeVarsInfo -> Id -> StgBinderInfo -- Find how the given Id is used. -- Externally visible things may be used any old how lookupFVInfo fvs id - | isExternallyVisibleName (idName id) = noBinderInfo + | isExternalName (idName id) = noBinderInfo | otherwise = case lookupVarEnv fvs id of Nothing -> noBinderInfo Just (_,_,info) -> info diff --git a/ghc/compiler/typecheck/TcEnv.lhs b/ghc/compiler/typecheck/TcEnv.lhs index f935d73..f80e2db 100644 --- a/ghc/compiler/typecheck/TcEnv.lhs +++ b/ghc/compiler/typecheck/TcEnv.lhs @@ -53,7 +53,7 @@ import DataCon ( DataCon ) import TyCon ( TyCon, DataConDetails ) import Class ( Class, ClassOpItem ) import Name ( Name, NamedThing(..), - getSrcLoc, mkLocalName, isLocalName, nameIsLocalOrFrom + getSrcLoc, mkInternalName, isInternalName, nameIsLocalOrFrom ) import NameEnv ( NameEnv, lookupNameEnv, nameEnvElts, elemNameEnv, extendNameEnvList, emptyNameEnv, plusNameEnv ) @@ -137,8 +137,8 @@ initTcEnv hst pte tcTyVars = gtv_var })} where - lookup name | isLocalName name = Nothing - | otherwise = lookupType hst pte name + lookup name | isInternalName name = Nothing + | otherwise = lookupType hst pte name tcEnvClasses env = typeEnvClasses (tcGEnv env) @@ -230,18 +230,18 @@ Constructing new Ids newLocalName :: Name -> NF_TcM Name newLocalName name -- Make a clone = tcGetUnique `thenNF_Tc` \ uniq -> - returnNF_Tc (mkLocalName uniq (getOccName name) (getSrcLoc name)) + returnNF_Tc (mkInternalName uniq (getOccName name) (getSrcLoc name)) \end{code} Make a name for the dict fun for an instance decl. It's a *local* name for the moment. The CoreTidy pass -will globalise it. +will externalise it. \begin{code} newDFunName :: Class -> [Type] -> SrcLoc -> NF_TcM Name newDFunName clas (ty:_) loc = tcGetUnique `thenNF_Tc` \ uniq -> - returnNF_Tc (mkLocalName uniq (mkDFunOcc dfun_string) loc) + returnNF_Tc (mkInternalName uniq (mkDFunOcc dfun_string) loc) where -- Any string that is somewhat unique will do dfun_string = occNameString (getOccName clas) ++ occNameString (getDFunTyKey ty) diff --git a/ghc/compiler/typecheck/TcForeign.lhs b/ghc/compiler/typecheck/TcForeign.lhs index c943b44..b2ddda6 100644 --- a/ghc/compiler/typecheck/TcForeign.lhs +++ b/ghc/compiler/typecheck/TcForeign.lhs @@ -37,7 +37,7 @@ import PrimRep ( getPrimRepSize, isFloatingRep ) import Module ( Module ) import Type ( typePrimRep ) import OccName ( mkForeignExportOcc ) -import Name ( NamedThing(..), mkGlobalName ) +import Name ( NamedThing(..), mkExternalName ) import TcType ( Type, tcSplitFunTys, tcSplitTyConApp_maybe, tcSplitForAllTys, isFFIArgumentTy, isFFIImportResultTy, @@ -221,7 +221,7 @@ tcFExport mod fo@(ForeignExport nm hs_ty spec isDeprec src_loc) = tcGetUnique `thenNF_Tc` \ uniq -> let - gnm = mkGlobalName uniq mod (mkForeignExportOcc (getOccName nm)) src_loc + gnm = mkExternalName uniq mod (mkForeignExportOcc (getOccName nm)) src_loc id = setIdLocalExported (mkLocalId gnm sig_ty) bind = VarMonoBind id rhs in diff --git a/ghc/compiler/typecheck/TcMType.lhs b/ghc/compiler/typecheck/TcMType.lhs index df429b7..c64e405 100644 --- a/ghc/compiler/typecheck/TcMType.lhs +++ b/ghc/compiler/typecheck/TcMType.lhs @@ -75,8 +75,8 @@ import PrelNames ( cCallableClassKey, cReturnableClassKey, hasKey ) import ForeignCall ( Safety(..) ) import FunDeps ( grow ) import PprType ( pprPred, pprSourceType, pprTheta, pprClassPred ) -import Name ( Name, NamedThing(..), setNameUnique, mkSysLocalName, - mkLocalName, mkDerivedTyConOcc +import Name ( Name, NamedThing(..), setNameUnique, mkSystemName, + mkInternalName, mkDerivedTyConOcc ) import VarSet import BasicTypes ( Boxity(Boxed) ) @@ -99,7 +99,7 @@ import Outputable newTyVar :: Kind -> NF_TcM TcTyVar newTyVar kind = tcGetUnique `thenNF_Tc` \ uniq -> - tcNewMutTyVar (mkSysLocalName uniq FSLIT("t")) kind VanillaTv + tcNewMutTyVar (mkSystemName uniq FSLIT("t")) kind VanillaTv newTyVarTy :: Kind -> NF_TcM TcType newTyVarTy kind @@ -108,7 +108,7 @@ newTyVarTy kind newHoleTyVarTy :: NF_TcM TcType = tcGetUnique `thenNF_Tc` \ uniq -> - tcNewMutTyVar (mkSysLocalName uniq FSLIT("h")) openTypeKind HoleTv `thenNF_Tc` \ tv -> + tcNewMutTyVar (mkSystemName uniq FSLIT("h")) openTypeKind HoleTv `thenNF_Tc` \ tv -> returnNF_Tc (TyVarTy tv) newTyVarTys :: Int -> Kind -> NF_TcM [TcType] @@ -117,7 +117,7 @@ newTyVarTys n kind = mapNF_Tc newTyVarTy (nOfThem n kind) newKindVar :: NF_TcM TcKind newKindVar = tcGetUnique `thenNF_Tc` \ uniq -> - tcNewMutTyVar (mkSysLocalName uniq FSLIT("k")) superKind VanillaTv `thenNF_Tc` \ kv -> + tcNewMutTyVar (mkSystemName uniq FSLIT("k")) superKind VanillaTv `thenNF_Tc` \ kv -> returnNF_Tc (TyVarTy kv) newKindVars :: Int -> NF_TcM [TcKind] @@ -126,7 +126,7 @@ newKindVars n = mapNF_Tc (\ _ -> newKindVar) (nOfThem n ()) newBoxityVar :: NF_TcM TcKind newBoxityVar = tcGetUnique `thenNF_Tc` \ uniq -> - tcNewMutTyVar (mkSysLocalName uniq FSLIT("bx")) superBoxity VanillaTv `thenNF_Tc` \ kv -> + tcNewMutTyVar (mkSystemName uniq FSLIT("bx")) superBoxity VanillaTv `thenNF_Tc` \ kv -> returnNF_Tc (TyVarTy kv) \end{code} @@ -162,7 +162,7 @@ tcInstTyVar tv_details tyvar -- that two different tyvars will print the same way -- in an error message. -dppr-debug will show up the difference -- Better watch out for this. If worst comes to worst, just - -- use mkSysLocalName. + -- use mkSystemName. in tcNewMutTyVar name (tyVarKind tyvar) tv_details @@ -382,7 +382,7 @@ mkArbitraryType tv -- I dread to think what will happen if this gets out into an -- interface file. Catastrophe likely. Major sigh. - tc_name = mkLocalName (getUnique tv) (mkDerivedTyConOcc (getOccName tv)) noSrcLoc + tc_name = mkInternalName (getUnique tv) (mkDerivedTyConOcc (getOccName tv)) noSrcLoc -- zonkTcTyVarToTyVar is applied to the *binding* occurrence -- of a type variable, at the *end* of type checking. It changes diff --git a/ghc/compiler/typecheck/TcType.lhs b/ghc/compiler/typecheck/TcType.lhs index 8286f64..3bcb389 100644 --- a/ghc/compiler/typecheck/TcType.lhs +++ b/ghc/compiler/typecheck/TcType.lhs @@ -132,7 +132,7 @@ import VarSet -- others: import CmdLineOpts ( DynFlags, DynFlag( Opt_GlasgowExts ), dopt ) -import Name ( Name, NamedThing(..), mkLocalName, getSrcLoc ) +import Name ( Name, NamedThing(..), mkInternalName, getSrcLoc ) import OccName ( OccName, mkDictOcc ) import NameSet import PrelNames -- Lots (e.g. in isFFIArgumentTy) @@ -517,8 +517,8 @@ predHasFDs (IParam _ _) = True predHasFDs (ClassP cls _) = classHasFDs cls mkPredName :: Unique -> SrcLoc -> SourceType -> Name -mkPredName uniq loc (ClassP cls tys) = mkLocalName uniq (mkDictOcc (getOccName cls)) loc -mkPredName uniq loc (IParam ip ty) = mkLocalName uniq (getOccName (ipNameName ip)) loc +mkPredName uniq loc (ClassP cls tys) = mkInternalName uniq (mkDictOcc (getOccName cls)) loc +mkPredName uniq loc (IParam ip ty) = mkInternalName uniq (getOccName (ipNameName ip)) loc \end{code} diff --git a/ghc/compiler/types/Generics.lhs b/ghc/compiler/types/Generics.lhs index 0f262d0..ca05c39 100644 --- a/ghc/compiler/types/Generics.lhs +++ b/ghc/compiler/types/Generics.lhs @@ -18,7 +18,7 @@ import DataCon ( DataCon, dataConOrigArgTys, dataConWrapId, dataConId, import TyCon ( TyCon, tyConTyVars, tyConDataCons_maybe, tyConGenInfo, isNewTyCon, newTyConRep, isBoxedTupleTyCon ) -import Name ( Name, mkSysLocalName ) +import Name ( Name, mkSystemName ) import CoreSyn ( mkLams, Expr(..), CoreExpr, AltCon(..), mkConApp, Alt, mkTyApps, mkVarApps ) import CoreUtils ( exprArity ) @@ -535,7 +535,7 @@ bimapTuple eps ------------------- genericNames :: [Name] -genericNames = [mkSysLocalName (mkBuiltinUnique i) (_PK_ ('g' : show i)) | i <- [1..]] +genericNames = [mkSystemName (mkBuiltinUnique i) (_PK_ ('g' : show i)) | i <- [1..]] (g1:g2:g3:_) = genericNames mk_hs_lam pats body = HsPar (HsLam (mkSimpleMatch pats body placeHolderType builtinSrcLoc)) diff --git a/ghc/compiler/types/Type.lhs b/ghc/compiler/types/Type.lhs index 2f93e9f..93a421a 100644 --- a/ghc/compiler/types/Type.lhs +++ b/ghc/compiler/types/Type.lhs @@ -89,7 +89,7 @@ import Var ( TyVar, tyVarKind, tyVarName, setTyVarName ) import VarEnv import VarSet -import Name ( NamedThing(..), mkLocalName, tidyOccName ) +import Name ( NamedThing(..), mkInternalName, tidyOccName ) import Class ( classTyCon ) import TyCon ( TyCon, isRecursiveTyCon, isPrimTyCon, isUnboxedTupleTyCon, isUnLiftedTyCon, @@ -650,7 +650,7 @@ tidyTyVarBndr (tidy_env, subst) tyvar where subst' = extendVarEnv subst tyvar tyvar' tyvar' = setTyVarName tyvar name' - name' = mkLocalName (getUnique name) occ' noSrcLoc + name' = mkInternalName (getUnique name) occ' noSrcLoc -- Note: make a *user* tyvar, so it printes nicely -- Could extract src loc, but no need. where