Commit b00b5bc0 authored by Simon Marlow's avatar Simon Marlow

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.
parent 7e623a3a
......@@ -895,7 +895,7 @@ mkPrimOpId prim_op
ty = mkForAllTys tyvars (mkFunTys arg_tys res_ty)
name = mkWiredInName gHC_PRIM (primOpOcc prim_op)
(mkPrimOpIdUnique (primOpTag prim_op))
Nothing (AnId id) UserSyntax
(AnId id) UserSyntax
id = mkGlobalId (PrimOpId prim_op) name ty info
info = noCafIdInfo
......@@ -1034,7 +1034,7 @@ another gun with which to shoot yourself in the foot.
\begin{code}
mkWiredInIdName mod fs uniq id
= mkWiredInName mod (mkOccNameFS varName fs) uniq Nothing (AnId id) UserSyntax
= mkWiredInName mod (mkOccNameFS varName fs) uniq (AnId id) UserSyntax
unsafeCoerceName = mkWiredInIdName gHC_PRIM FSLIT("unsafeCoerce#") unsafeCoerceIdKey unsafeCoerceId
nullAddrName = mkWiredInIdName gHC_PRIM FSLIT("nullAddr#") nullAddrIdKey nullAddrId
......
......@@ -21,7 +21,7 @@ module Name (
tidyNameOcc,
hashName, localiseName,
nameSrcLoc, nameParent, nameParent_maybe, isImplicitName,
nameSrcLoc,
isSystemName, isInternalName, isExternalName,
isTyVarName, isTyConName, isWiredInName, isBuiltInSyntax,
......@@ -40,13 +40,18 @@ import {-# SOURCE #-} TypeRep( TyThing )
import OccName -- All of it
import Module ( Module )
import SrcLoc ( noSrcLoc, wiredInSrcLoc, SrcLoc )
import UniqFM ( lookupUFM, addToUFM )
import Unique ( Unique, Uniquable(..), getKey, pprUnique,
mkUniqueGrimily, getKey# )
import Maybes ( orElse, isJust )
import Binary
import FastMutInt
import FastString ( FastString, zEncodeFS )
import Outputable
import DATA_IOREF
import GLAEXTS ( Int#, Int(..) )
import Data.Array ( (!) )
\end{code}
%************************************************************************
......@@ -68,12 +73,9 @@ data Name = Name {
-- the SrcLoc in a Name all that often.
data NameSort
= External Module (Maybe Name)
-- (Just parent) => this Name is a subordinate name of 'parent'
-- e.g. data constructor of a data type, method of a class
-- Nothing => not a subordinate
= External Module
| WiredIn Module (Maybe Name) TyThing BuiltInSyntax
| WiredIn Module TyThing BuiltInSyntax
-- A variant of External, for wired-in things
| Internal -- A user-defined Id or TyVar
......@@ -137,41 +139,26 @@ isExternalName :: Name -> Bool
isSystemName :: Name -> Bool
isWiredInName :: Name -> Bool
isWiredInName (Name {n_sort = WiredIn _ _ _ _}) = True
isWiredInName other = False
isWiredInName (Name {n_sort = WiredIn _ _ _}) = True
isWiredInName other = False
wiredInNameTyThing_maybe :: Name -> Maybe TyThing
wiredInNameTyThing_maybe (Name {n_sort = WiredIn _ _ thing _}) = Just thing
wiredInNameTyThing_maybe other = Nothing
wiredInNameTyThing_maybe (Name {n_sort = WiredIn _ thing _}) = Just thing
wiredInNameTyThing_maybe other = Nothing
isBuiltInSyntax (Name {n_sort = WiredIn _ _ _ BuiltInSyntax}) = True
isBuiltInSyntax other = False
isBuiltInSyntax (Name {n_sort = WiredIn _ _ BuiltInSyntax}) = True
isBuiltInSyntax other = False
isExternalName (Name {n_sort = External _ _}) = True
isExternalName (Name {n_sort = WiredIn _ _ _ _}) = True
isExternalName other = False
isExternalName (Name {n_sort = External _}) = True
isExternalName (Name {n_sort = WiredIn _ _ _}) = True
isExternalName other = False
isInternalName name = not (isExternalName name)
nameParent_maybe :: Name -> Maybe Name
nameParent_maybe (Name {n_sort = External _ p}) = p
nameParent_maybe (Name {n_sort = WiredIn _ p _ _}) = p
nameParent_maybe other = Nothing
nameParent :: Name -> Name
nameParent name = case nameParent_maybe name of
Just parent -> parent
Nothing -> name
isImplicitName :: Name -> Bool
-- An Implicit Name is one has a parent; that is, one whose definition
-- derives from the parent thing
isImplicitName name = isJust (nameParent_maybe name)
nameModule name = nameModule_maybe name `orElse` pprPanic "nameModule" (ppr name)
nameModule_maybe (Name { n_sort = External mod _}) = Just mod
nameModule_maybe (Name { n_sort = WiredIn mod _ _ _}) = Just mod
nameModule_maybe name = Nothing
nameModule_maybe (Name { n_sort = External mod}) = Just mod
nameModule_maybe (Name { n_sort = WiredIn mod _ _}) = Just mod
nameModule_maybe name = Nothing
nameIsLocalOrFrom from name
| isExternalName name = from == nameModule name
......@@ -206,16 +193,16 @@ mkInternalName uniq occ loc = Name { n_uniq = getKey# uniq, n_sort = Internal, n
-- * for interface files we tidyCore first, which puts the uniques
-- into the print name (see setNameVisibility below)
mkExternalName :: Unique -> Module -> OccName -> Maybe Name -> SrcLoc -> Name
mkExternalName uniq mod occ mb_parent loc
= Name { n_uniq = getKey# uniq, n_sort = External mod mb_parent,
mkExternalName :: Unique -> Module -> OccName -> SrcLoc -> Name
mkExternalName uniq mod occ loc
= Name { n_uniq = getKey# uniq, n_sort = External mod,
n_occ = occ, n_loc = loc }
mkWiredInName :: Module -> OccName -> Unique
-> Maybe Name -> TyThing -> BuiltInSyntax -> Name
mkWiredInName mod occ uniq mb_parent thing built_in
mkWiredInName :: Module -> OccName -> Unique -> TyThing -> BuiltInSyntax
-> Name
mkWiredInName mod occ uniq thing built_in
= Name { n_uniq = getKey# uniq,
n_sort = WiredIn mod mb_parent thing built_in,
n_sort = WiredIn mod thing built_in,
n_occ = occ, n_loc = wiredInSrcLoc }
mkSystemName :: Unique -> OccName -> Name
......@@ -301,6 +288,33 @@ instance NamedThing Name where
getName n = n
\end{code}
%************************************************************************
%* *
\subsection{Binary}
%* *
%************************************************************************
\begin{code}
instance Binary Name where
put_ bh name = do
case getUserData bh of {
UserData { ud_symtab_map = symtab_map_ref,
ud_symtab_next = symtab_next } -> do
symtab_map <- readIORef symtab_map_ref
case lookupUFM symtab_map name of
Just (off,_) -> put_ bh off
Nothing -> do
off <- readFastMutInt symtab_next
writeFastMutInt symtab_next (off+1)
writeIORef symtab_map_ref
$! addToUFM symtab_map name (off,name)
put_ bh off
}
get bh = do
i <- get bh
return $! (ud_symtab (getUserData bh) ! i)
\end{code}
%************************************************************************
%* *
......@@ -318,8 +332,8 @@ instance OutputableBndr Name where
pprName name@(Name {n_sort = sort, n_uniq = u#, n_occ = occ})
= getPprStyle $ \ sty ->
case sort of
WiredIn mod _ _ builtin -> pprExternal sty uniq mod occ True builtin
External mod _ -> pprExternal sty uniq mod occ False UserSyntax
WiredIn mod _ builtin -> pprExternal sty uniq mod occ True builtin
External mod -> pprExternal sty uniq mod occ False UserSyntax
System -> pprSystem sty uniq occ
Internal -> pprInternal sty uniq occ
where uniq = mkUniqueGrimily (I# u#)
......
......@@ -42,7 +42,7 @@ module RdrName (
import OccName
import Module ( ModuleName, mkModuleNameFS, Module, moduleName )
import Name ( Name, NamedThing(getName), nameModule, nameParent_maybe,
import Name ( Name, NamedThing(getName), nameModule,
nameOccName, isExternalName, nameSrcLoc )
import Maybes ( mapCatMaybes )
import SrcLoc ( isGoodSrcLoc, isGoodSrcSpan, srcLocSpan, SrcSpan )
......@@ -308,8 +308,7 @@ data GlobalRdrElt
}
instance Outputable GlobalRdrElt where
ppr gre = ppr name <+> pp_parent (nameParent_maybe name)
<+> parens (pprNameProvenance gre)
ppr gre = ppr name <+> parens (pprNameProvenance gre)
where
name = gre_name gre
pp_parent (Just p) = brackets (text "parent:" <+> ppr p)
......
......@@ -330,7 +330,7 @@ maybeExternaliseId dflags id
; returnFC (setIdName id (externalise mod)) }
| otherwise = returnFC id
where
externalise mod = mkExternalName uniq mod new_occ Nothing loc
externalise mod = mkExternalName uniq mod new_occ loc
name = idName id
uniq = nameUnique name
new_occ = mkLocalOcc uniq (nameOccName name)
......
......@@ -13,7 +13,7 @@ import StaticFlags ( opt_SccProfilingOn,
opt_AutoSccsOnAllToplevs,
opt_AutoSccsOnExportedToplevs )
import DriverPhases ( isHsBoot )
import HscTypes ( ModGuts(..), HscEnv(..),
import HscTypes ( ModGuts(..), HscEnv(..), availsToNameSet,
Dependencies(..), ForeignStubs(..), TypeEnv, IsBootInterface )
import HsSyn ( RuleDecl(..), RuleBndr(..), LHsExpr, LRuleDecl )
import TcRnTypes ( TcGblEnv(..), ImportAvails(..) )
......@@ -78,7 +78,8 @@ deSugar hsc_env
= do { showPass dflags "Desugar"
-- Desugar the program
; let auto_scc = mkAutoScc mod exports
; let export_set = availsToNameSet exports
; let auto_scc = mkAutoScc mod export_set
; mb_res <- case ghcMode dflags of
JustTypecheck -> return (Just ([], [], NoStubs))
......@@ -96,8 +97,8 @@ deSugar hsc_env
{ -- Add export flags to bindings
keep_alive <- readIORef keep_var
; let final_prs = addExportFlags ghci_mode exports keep_alive
all_prs ds_rules
; let final_prs = addExportFlags ghci_mode export_set
keep_alive all_prs ds_rules
ds_binds = [Rec final_prs]
-- Notice that we put the whole lot in a big Rec, even the foreign binds
-- When compiling PrelFloat, which defines data Float = F# Float#
......
......@@ -22,7 +22,7 @@ module DsMeta( dsBracket,
import {-# SOURCE #-} DsExpr ( dsExpr )
import MatchLit ( dsLit )
import DsUtils ( mkListExpr, mkStringExpr, mkIntExpr )
import DsUtils ( mkListExpr, mkStringExpr, mkCoreTup, mkIntExpr )
import DsMonad
import qualified Language.Haskell.TH as TH
......@@ -1306,6 +1306,9 @@ nonEmptyCoreList :: [Core a] -> Core [a]
nonEmptyCoreList [] = panic "coreList: empty argument"
nonEmptyCoreList xs@(MkC x:_) = MkC (mkListExpr (exprType x) (map unC xs))
corePair :: (Core a, Core b) -> Core (a,b)
corePair (MkC x, MkC y) = MkC (mkCoreTup [x,y])
coreStringLit :: String -> DsM (Core String)
coreStringLit s = do { z <- mkStringExpr s; return(MkC z) }
......
......@@ -9,20 +9,39 @@ module BinIface ( writeBinIface, readBinIface, v_IgnoreHiWay ) where
#include "HsVersions.h"
import TcRnMonad ( TcRnIf, ioToIOEnv )
import IfaceEnv
import HscTypes
import BasicTypes
import NewDemand
import IfaceSyn
import Module ( ModuleName, mkModule, modulePackageId, moduleName )
import Name
import OccName ( OccName )
import VarEnv
import InstEnv ( OverlapFlag(..) )
import Class ( DefMeth(..) )
import DynFlags ( DynFlags )
import UniqFM ( UniqFM, eltsUFM )
import UniqSupply ( uniqFromSupply, splitUniqSupply )
import CostCentre
import StaticFlags ( opt_HiVersion, v_Build_tag )
import Type ( Kind,
isLiftedTypeKind, isUnliftedTypeKind, isOpenTypeKind,
isArgTypeKind, isUbxTupleKind, liftedTypeKind,
unliftedTypeKind, openTypeKind, argTypeKind,
ubxTupleKind, mkArrowKind, splitFunTy_maybe )
import PackageConfig ( PackageId )
import Panic
import Binary
import SrcLoc ( noSrcLoc )
import Util
import ErrUtils ( debugTraceMsg )
import Config ( cGhcUnregisterised )
import FastMutInt ( readFastMutInt )
import Data.Word ( Word32 )
import Data.Array ( Array, array, elems, listArray, (!) )
import DATA_IOREF
import EXCEPTION ( throwDyn )
import Monad ( when )
......@@ -31,19 +50,164 @@ import Outputable
#include "HsVersions.h"
-- ---------------------------------------------------------------------------
writeBinIface :: FilePath -> ModIface -> IO ()
writeBinIface hi_path mod_iface
= putBinFileWithDict hi_path mod_iface
readBinIface :: FilePath -> IO ModIface
readBinIface hi_path = getBinFileWithDict hi_path
-- %*********************************************************
-- %* *
-- All the Binary instances
-- %* *
-- %*********************************************************
-- Reading and writing binary interface files
readBinIface :: FilePath -> TcRnIf a b ModIface
readBinIface hi_path = do
nc <- getNameCache
(new_nc, iface) <- ioToIOEnv $ readBinIface_ hi_path nc
setNameCache new_nc
return iface
readBinIface_ :: FilePath -> NameCache -> IO (NameCache, ModIface)
readBinIface_ hi_path nc = do
bh <- Binary.readBinMem hi_path
-- Read the magic number to check that this really is a GHC .hi file
-- (This magic number does not change when we change
-- GHC interface file format)
magic <- get bh
when (magic /= binaryInterfaceMagic) $
throwDyn (ProgramError (
"magic number mismatch: old/corrupt interface file?"))
-- Read the dictionary
-- The next word in the file is a pointer to where the dictionary is
-- (probably at the end of the file)
dict_p <- Binary.get bh -- Get the dictionary ptr
data_p <- tellBin bh -- Remember where we are now
seekBin bh dict_p
dict <- getDictionary bh
seekBin bh data_p -- Back to where we were before
-- Initialise the user-data field of bh
ud <- newReadState dict
bh <- return (setUserData bh ud)
symtab_p <- Binary.get bh -- Get the symtab ptr
data_p <- tellBin bh -- Remember where we are now
seekBin bh symtab_p
(nc', symtab) <- getSymbolTable bh nc
seekBin bh data_p -- Back to where we were before
let ud = getUserData bh
bh <- return $! setUserData bh ud{ud_symtab = symtab}
iface <- get bh
return (nc', iface)
writeBinIface :: DynFlags -> FilePath -> ModIface -> IO ()
writeBinIface dflags hi_path mod_iface = do
bh <- openBinMem initBinMemSize
put_ bh binaryInterfaceMagic
-- Remember where the dictionary pointer will go
dict_p_p <- tellBin bh
put_ bh dict_p_p -- Placeholder for ptr to dictionary
-- Remember where the symbol table pointer will go
symtab_p_p <- tellBin bh
put_ bh symtab_p_p
-- Make some intial state
ud <- newWriteState
-- Put the main thing,
bh <- return $ setUserData bh ud
put_ bh mod_iface
-- Write the symtab pointer at the fornt of the file
symtab_p <- tellBin bh -- This is where the symtab will start
putAt bh symtab_p_p symtab_p -- Fill in the placeholder
seekBin bh symtab_p -- Seek back to the end of the file
-- Write the symbol table itself
symtab_next <- readFastMutInt (ud_symtab_next ud)
symtab_map <- readIORef (ud_symtab_map ud)
putSymbolTable bh symtab_next symtab_map
debugTraceMsg dflags 3 (text "writeBinIface:" <+> int symtab_next
<+> text "Names")
-- NB. write the dictionary after the symbol table, because
-- writing the symbol table may create more dictionary entries.
-- Write the dictionary pointer at the fornt of the file
dict_p <- tellBin bh -- This is where the dictionary will start
putAt bh dict_p_p dict_p -- Fill in the placeholder
seekBin bh dict_p -- Seek back to the end of the file
-- Write the dictionary itself
dict_next <- readFastMutInt (ud_dict_next ud)
dict_map <- readIORef (ud_dict_map ud)
putDictionary bh dict_next dict_map
debugTraceMsg dflags 3 (text "writeBinIface:" <+> int dict_next
<+> text "dict entries")
-- And send the result to the file
writeBinMem bh hi_path
initBinMemSize = (1024*1024) :: Int
-- The *host* architecture version:
#include "MachDeps.h"
#if WORD_SIZE_IN_BITS == 32
binaryInterfaceMagic = 0x1face :: Word32
#elif WORD_SIZE_IN_BITS == 64
binaryInterfaceMagic = 0x1face64 :: Word32
#endif
-- -----------------------------------------------------------------------------
-- The symbol table
putSymbolTable :: BinHandle -> Int -> UniqFM (Int,Name) -> IO ()
putSymbolTable bh next_off symtab = do
put_ bh next_off
let names = elems (array (0,next_off-1) (eltsUFM symtab))
mapM_ (\n -> serialiseName bh n symtab) names
getSymbolTable :: BinHandle -> NameCache -> IO (NameCache, Array Int Name)
getSymbolTable bh namecache = do
sz <- get bh
od_names <- sequence (replicate sz (get bh))
let
arr = listArray (0,sz-1) names
(namecache', names) =
mapAccumR (fromOnDiskName arr) namecache od_names
--
return (namecache', arr)
type OnDiskName = (PackageId, ModuleName, OccName)
fromOnDiskName
:: Array Int Name
-> NameCache
-> OnDiskName
-> (NameCache, Name)
fromOnDiskName arr nc (pid, mod_name, occ) =
let
mod = mkModule pid mod_name
cache = nsNames nc
in
case lookupOrigNameCache cache mod occ of
Just name -> (nc, name)
Nothing ->
let
us = nsUniqs nc
uniq = uniqFromSupply us
name = mkExternalName uniq mod occ noSrcLoc
new_cache = extendNameCache cache mod occ name
in
case splitUniqSupply us of { (us',_) ->
( nc{ nsUniqs = us', nsNames = new_cache }, name )
}
serialiseName :: BinHandle -> Name -> UniqFM (Int,Name) -> IO ()
serialiseName bh name symtab = do
let mod = nameModule name
put_ bh (modulePackageId mod, moduleName mod, nameOccName name)
-- -----------------------------------------------------------------------------
-- All the binary instances
-- BasicTypes
{-! for IPName derive: Binary !-}
......@@ -504,36 +668,6 @@ instance Binary CostCentre where
-- IfaceTypes and friends
-------------------------------------------------------------------------
instance Binary IfaceExtName where
put_ bh (ExtPkg mod occ) = do
putByte bh 0
put_ bh mod
put_ bh occ
put_ bh (HomePkg mod occ vers) = do
putByte bh 1
put_ bh mod
put_ bh occ
put_ bh vers
put_ bh (LocalTop occ) = do
putByte bh 2
put_ bh occ
put_ bh (LocalTopSub occ _) = do -- Write LocalTopSub just like LocalTop
putByte bh 2
put_ bh occ
get bh = do
h <- getByte bh
case h of
0 -> do mod <- get bh
occ <- get bh
return (ExtPkg mod occ)
1 -> do mod <- get bh
occ <- get bh
vers <- get bh
return (HomePkg mod occ vers)
_ -> do occ <- get bh
return (LocalTop occ)
instance Binary IfaceBndr where
put_ bh (IfaceIdBndr aa) = do
putByte bh 0
......@@ -884,17 +1018,23 @@ instance Binary IfaceNote where
-- IfaceDecl and friends
-------------------------------------------------------------------------
-- A bit of magic going on here: there's no need to store the OccName
-- for a decl on the disk, since we can infer the namespace from the
-- context; however it is useful to have the OccName in the IfaceDecl
-- to avoid re-building it in various places. So we build the OccName
-- when de-serialising.
instance Binary IfaceDecl where
put_ bh (IfaceId name ty idinfo) = do
putByte bh 0
put_ bh name
put_ bh (occNameFS name)
put_ bh ty
put_ bh idinfo
put_ bh (IfaceForeign ae af) =
error "Binary.put_(IfaceDecl): IfaceForeign"
put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8) = do
putByte bh 2
put_ bh a1
put_ bh (occNameFS a1)
put_ bh a2
put_ bh a3
put_ bh a4
......@@ -904,14 +1044,14 @@ instance Binary IfaceDecl where
put_ bh a8
put_ bh (IfaceSyn aq ar as at) = do
putByte bh 3
put_ bh aq
put_ bh (occNameFS aq)
put_ bh ar
put_ bh as
put_ bh at
put_ bh (IfaceClass a1 a2 a3 a4 a5 a6 a7) = do
putByte bh 4
put_ bh a1
put_ bh a2
put_ bh (occNameFS a2)
put_ bh a3
put_ bh a4
put_ bh a5
......@@ -923,7 +1063,8 @@ instance Binary IfaceDecl where
0 -> do name <- get bh
ty <- get bh
idinfo <- get bh
return (IfaceId name ty idinfo)
occ <- return $! mkOccNameFS varName name
return (IfaceId occ ty idinfo)
1 -> error "Binary.get(TyClDecl): ForeignType"
2 -> do
a1 <- get bh
......@@ -934,13 +1075,15 @@ instance Binary IfaceDecl where
a6 <- get bh
a7 <- get bh
a8 <- get bh
return (IfaceData a1 a2 a3 a4 a5 a6 a7 a8)
occ <- return $! mkOccNameFS tcName a1
return (IfaceData occ a2 a3 a4 a5 a6 a7 a8)
3 -> do
aq <- get bh
ar <- get bh
as <- get bh
at <- get bh
return (IfaceSyn aq ar as at)
occ <- return $! mkOccNameFS tcName aq
return (IfaceSyn occ ar as at)
_ -> do
a1 <- get bh
a2 <- get bh
......@@ -949,7 +1092,8 @@ instance Binary IfaceDecl where
a5 <- get bh
a6 <- get bh
a7 <- get bh
return (IfaceClass a1 a2 a3 a4 a5 a6 a7)
occ <- return $! mkOccNameFS clsName a2
return (IfaceClass a1 occ a3 a4 a5 a6 a7)
instance Binary IfaceInst where
put_ bh (IfaceInst cls tys dfun flag orph) = do
......@@ -1028,14 +1172,15 @@ instance Binary IfaceConDecl where
instance Binary IfaceClassOp where
put_ bh (IfaceClassOp n def ty) = do
put_ bh n
put_ bh (occNameFS n)
put_ bh def
put_ bh ty
get bh = do
n <- get bh
def <- get bh
ty <- get bh
return (IfaceClassOp n def ty)
occ <- return $! mkOccNameFS varName n
return (IfaceClassOp occ def ty)
instance Binary IfaceRule where
put_ bh (IfaceRule a1 a2 a3 a4 a5 a6 a7) = do
......
......@@ -3,31 +3,31 @@
\begin{code}
module IfaceEnv (
newGlobalBinder, newIPName, newImplicitBinder,
lookupIfaceTop, lookupIfaceExt,
lookupOrig, lookupIfaceTc,
lookupIfaceTop,
lookupOrig, lookupOrigNameCache, extendNameCache,
newIfaceName, newIfaceNames,
extendIfaceIdEnv, extendIfaceTyVarEnv,
tcIfaceLclId, tcIfaceTyVar,
lookupAvail, ifaceExportNames,
ifaceExportNames,
-- Name-cache stuff
allocateGlobalBinder, initNameCache,
getNameCache, setNameCache
) where
#include "HsVersions.h"
import TcRnMonad
import IfaceType ( IfaceExtName(..), IfaceTyCon(..), ifaceTyConName )
import TysWiredIn ( tupleTyCon, tupleCon )
import HscTypes ( NameCache(..), HscEnv(..), GenAvailInfo(..),
IfaceExport, OrigNameCache )
IfaceExport, OrigNameCache, AvailInfo )
import Type ( mkOpenTvSubst, substTy )
import TyCon ( TyCon, tyConName )
import DataCon ( dataConWorkId, dataConName )
import Var ( TyVar, Id, varName )
import Name ( Name, nameUnique, nameModule,