diff options
author | Simon Marlow <simonmar@microsoft.com> | 2006-10-11 12:05:18 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2006-10-11 12:05:18 +0000 |
commit | b00b5bc04ff36a551552470060064f0b7d84ca30 (patch) | |
tree | 9b3ae9433218dd1388a640f2aad7f3e37d63711e /compiler/parser | |
parent | 7e623a3a6c4fa75bae5be29a9fca015f98f1c30b (diff) | |
download | haskell-b00b5bc04ff36a551552470060064f0b7d84ca30.tar.gz |
Interface file optimisation and removal of nameParent
This large commit combines several interrelated changes:
- IfaceSyn now contains actual Names rather than the special
IfaceExtName type. The binary interface file contains
a symbol table of Names, where each entry is a (package,
ModuleName, OccName) triple. Names in the IfaceSyn point
to entries in the symbol table.
This reduces the size of interface files, which should
hopefully improve performance (not measured yet).
The toIfaceXXX functions now do not need to pass around
a function from Name -> IfaceExtName, which makes that
code simpler.
- Names now do not point directly to their parents, and the
nameParent operation has gone away. It turned out to be hard to
keep this information consistent in practice, and the parent info
was only valid in some Names. Instead we made the following
changes:
* ImportAvails contains a new field
imp_parent :: NameEnv AvailInfo
which gives the family info for any Name in scope, and
is used by the renamer when renaming export lists, amongst
other things. This info is thrown away after renaming.
* The mi_ver_fn field of ModIface now maps to
(OccName,Version) instead of just Version, where the
OccName is the parent name. This mapping is used when
constructing the usage info for dependent modules.
There may be entries in mi_ver_fn for things that are not in
scope, whereas imp_parent only deals with in-scope things.
* The md_exports field of ModDetails now contains
[AvailInfo] rather than NameSet. This gives us
family info for the exported names of a module.
Also:
- ifaceDeclSubBinders moved to IfaceSyn (seems like the
right place for it).
- heavily refactored renaming of import/export lists.
- Unfortunately external core is now broken, as it relied on
IfaceSyn. It requires some attention.
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/ParserCore.y | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/compiler/parser/ParserCore.y b/compiler/parser/ParserCore.y index dd3d8b7543..b37add305e 100644 --- a/compiler/parser/ParserCore.y +++ b/compiler/parser/ParserCore.y @@ -11,7 +11,7 @@ import Type ( Kind, liftedTypeKindTyCon, openTypeKindTyCon, unliftedTypeKindTyCon, argTypeKindTyCon, ubxTupleKindTyCon, mkArrowKind, mkTyConApp ) -import Name( nameOccName, nameModule ) +import Name( Name, nameOccName, nameModule ) import Module import PackageConfig ( mainPackageId ) import ParserCoreUtils @@ -225,7 +225,7 @@ kind :: { IfaceKind } aexp :: { IfaceExpr } : var_occ { IfaceLcl $1 } - | modid '.' qd_occ { IfaceExt (ExtPkg $1 (mkVarOccFS $3)) } + | modid '.' qd_occ { IfaceExt undefined {-ToDo!!! (ExtPkg $1 (mkVarOccFS $3))-} } | lit { IfaceLit $1 } | '(' exp ')' { $2 } @@ -258,7 +258,7 @@ alts1 :: { [IfaceAlt] } alt :: { IfaceAlt } : modid '.' d_pat_occ bndrs '->' exp - { (IfaceDataAlt $3, map ifaceBndrName $4, $6) } + { (IfaceDataAlt undefined {-ToDo!!! $3 -}, map ifaceBndrName $4, $6) } -- The external syntax currently includes the types of the -- the args, but they aren't needed internally -- Nor is the module qualifier @@ -281,8 +281,8 @@ var_occ :: { FastString } -- Type constructor -q_tc_name :: { IfaceExtName } - : modid '.' CNAME { ExtPkg $1 (mkOccName tcName $3) } +q_tc_name :: { Name } + : modid '.' CNAME { undefined {-ToDo!!! ExtPkg $1 (mkOccName tcName $3)-} } -- Data constructor in a pattern or data type declaration; use the dataName, -- because that's what we expect in Core case patterns @@ -318,10 +318,7 @@ convRatLit i aty = pprPanic "Unknown rational literal type" (ppr aty) eqTc :: IfaceTyCon -> TyCon -> Bool -- Ugh! -eqTc (IfaceTc (ExtPkg mod occ)) tycon - = mod == nameModule nm && occ == nameOccName nm - where - nm = tyConName tycon +eqTc (IfaceTc name) tycon = name == tyConName tycon -- Tiresomely, we have to generate both HsTypes (in type/class decls) -- and IfaceTypes (in Core expressions). So we parse them as IfaceTypes, @@ -361,8 +358,8 @@ ifaceArrow ifT1 ifT2 = IfaceFunTy ifT1 ifT2 toHsTvBndr :: IfaceTvBndr -> LHsTyVarBndr RdrName toHsTvBndr (tv,k) = noLoc $ KindedTyVar (mkRdrUnqual (mkTyVarOcc tv)) (toKind k) -ifaceExtRdrName :: IfaceExtName -> RdrName -ifaceExtRdrName (ExtPkg mod occ) = mkOrig mod occ +ifaceExtRdrName :: Name -> RdrName +ifaceExtRdrName name = mkOrig (nameModule name) (nameOccName name) ifaceExtRdrName other = pprPanic "ParserCore.ifaceExtRdrName" (ppr other) add_forall tv (L _ (HsForAllTy exp tvs cxt t)) |