Interface file optimisation and removal of nameParent
authorSimon Marlow <simonmar@microsoft.com>
Wed, 11 Oct 2006 12:05:18 +0000 (12:05 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Wed, 11 Oct 2006 12:05:18 +0000 (12:05 +0000)
commitb00b5bc04ff36a551552470060064f0b7d84ca30
tree9b3ae9433218dd1388a640f2aad7f3e37d63711e
parent7e623a3a6c4fa75bae5be29a9fca015f98f1c30b
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.
36 files changed:
compiler/basicTypes/MkId.lhs
compiler/basicTypes/Name.lhs
compiler/basicTypes/RdrName.lhs
compiler/codeGen/CodeGen.lhs
compiler/deSugar/Desugar.lhs
compiler/deSugar/DsMeta.hs
compiler/iface/BinIface.hs
compiler/iface/IfaceEnv.lhs
compiler/iface/IfaceSyn.lhs
compiler/iface/IfaceType.lhs
compiler/iface/LoadIface.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/main/GHC.hs
compiler/main/HscMain.lhs
compiler/main/HscTypes.lhs
compiler/main/Main.hs
compiler/main/TidyPgm.lhs
compiler/parser/ParserCore.y
compiler/prelude/PrelNames.lhs
compiler/prelude/TysPrim.lhs
compiler/prelude/TysWiredIn.lhs
compiler/rename/RnEnv.lhs
compiler/rename/RnExpr.lhs
compiler/rename/RnNames.lhs
compiler/typecheck/TcEnv.lhs
compiler/typecheck/TcForeign.lhs
compiler/typecheck/TcRnDriver.lhs
compiler/typecheck/TcRnMonad.lhs
compiler/typecheck/TcRnTypes.lhs
compiler/typecheck/TcTyDecls.lhs
compiler/types/Coercion.lhs
compiler/types/TyCon.lhs
compiler/types/TypeRep.lhs
compiler/utils/Binary.hs
compiler/utils/IOEnv.hs