X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FHscTypes.lhs;h=5fd475cffbad46fc929997225126ff07fcd3f421;hb=3721dd37a707d2aacb5cac814410a78096e28a2c;hp=7cb86bfb42be033fbb0e930febac267a98f57222;hpb=98688c6e8fd33f31c51218cf93cbf03fe3a5e73d;p=ghc-hetmet.git diff --git a/ghc/compiler/main/HscTypes.lhs b/ghc/compiler/main/HscTypes.lhs index 7cb86bf..5fd475c 100644 --- a/ghc/compiler/main/HscTypes.lhs +++ b/ghc/compiler/main/HscTypes.lhs @@ -39,7 +39,7 @@ module HscTypes ( Dependencies(..), noDependencies, Pool(..), emptyPool, DeclPool, InstPool, Gated, - RulePool, addRuleToPool, + RulePool, RulePoolContents, addRuleToPool, NameCache(..), OrigNameCache, OrigIParamCache, Avails, availsToNameSet, availName, availNames, GenAvailInfo(..), AvailInfo, RdrAvailInfo, @@ -93,7 +93,7 @@ import CoreSyn ( IdCoreRule ) import PrelNames ( isBuiltInSyntaxName ) import Maybes ( orElse ) import Outputable -import SrcLoc ( SrcLoc ) +import SrcLoc ( SrcSpan ) import UniqSupply ( UniqSupply ) import Maybe ( fromJust ) import FastString ( FastString ) @@ -275,7 +275,7 @@ data ModDetails data ModGuts = ModGuts { mg_module :: !Module, - mg_exports :: !Avails, -- What it exports + mg_exports :: !NameSet, -- What it exports mg_deps :: !Dependencies, -- What is below it, directly or otherwise mg_dir_imps :: ![Module], -- Directly-imported modules; used to -- generate initialisation code @@ -629,7 +629,7 @@ emptyIfaceFixCache n = defaultFixity type FixityEnv = NameEnv FixItem -- We keep the OccName in the range so that we can generate an interface from it -data FixItem = FixItem OccName Fixity SrcLoc +data FixItem = FixItem OccName Fixity SrcSpan instance Outputable FixItem where ppr (FixItem occ fix loc) = ppr fix <+> ppr occ <+> parens (ppr loc) @@ -739,14 +739,7 @@ data ExternalPackageState -- available before this instance decl is needed. eps_rules :: !RulePool - -- Rules move from here to eps_rule_base when - -- all their LHS free vars are in the eps_PTE - -- To maintain this invariant, we need to check the pool - -- a) when adding to the rule pool by loading an interface - -- (some of the new rules may alrady have all their - -- gates in the eps_PTE) - -- b) when extending the eps_PTE when we load a decl - -- from the eps_decls pool + -- The as-yet un-slurped rules } \end{code} @@ -777,36 +770,35 @@ type OrigIParamCache = FiniteMap (IPName OccName) (IPName Name) \end{code} \begin{code} -data Pool p = Pool (NameEnv p) -- The pool itself, indexed by some primary key +data Pool p = Pool p -- The pool itself Int -- Number of decls slurped into the map Int -- Number of decls slurped out of the map -emptyPool = Pool emptyNameEnv 0 0 +emptyPool p = Pool p 0 0 instance Outputable p => Outputable (Pool p) where ppr (Pool p n_in n_out) -- Debug printing only = vcat [ptext SLIT("Pool") <+> int n_in <+> int n_out, nest 2 (ppr p)] -type DeclPool = Pool IfaceDecl +type DeclPool = Pool (NameEnv IfaceDecl) -- Keyed by the "main thing" of the decl ------------------------- type Gated d = ([Name], (ModuleName, d)) -- The [Name] 'gate' the declaration -- ModuleName records which iface file this -- decl came from -type RulePool = Pool [Gated IfaceRule] +type RulePool = Pool RulePoolContents +type RulePoolContents = [Gated IfaceRule] -addRuleToPool :: NameEnv [Gated IfaceRule] +addRuleToPool :: RulePoolContents -> (ModuleName, IfaceRule) -> [Name] -- Free vars of rule; always non-empty - -> NameEnv [Gated IfaceRule] -addRuleToPool rules rule (fv:fvs) = extendNameEnv_C combine rules fv [(fvs,rule)] - where - combine old _ = (fvs,rule) : old + -> RulePoolContents +addRuleToPool rules rule fvs = (fvs,rule) : rules ------------------------- -type InstPool = Pool [Gated IfaceInst] +type InstPool = Pool (NameEnv [Gated IfaceInst]) -- The key of the Pool is the Class -- The Names are the TyCons in the instance head -- For example, suppose this is in an interface file