Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
aa44169c
Commit
aa44169c
authored
Oct 23, 2000
by
simonpj
Browse files
[project @ 2000-10-23 09:03:26 by simonpj]
Mainly renamer
parent
e4f0e4ad
Changes
31
Hide whitespace changes
Inline
Side-by-side
ghc/compiler/NOTES
View file @
aa44169c
Notes July 00
~~~~~~~~~~~~~~
Time.lhs: fails with too many arguments to C function
works with native code gen
CTypes.lhs: fails with
/tmp/ghc2840.hc:42413: fixed or forbidden register 3 (bx) was spilled for class GENERAL_REGS.
This may be due to a compiler bug or to impossible asm statements or clauses.
works without -O
posix/* fails with
ghc1653.c:4: `#include' expects "FILENAME" or <FILENAME>
ghc1653.c:6: `#include' expects "FILENAME" or <FILENAME>
works when one fixes the makefile
make depend needs the -osuf o removed.
CTypes also has a Subst-worker WARNING.
Notes June 99
~~~~~~~~~~~~~
* In nofib/spectral/mandel2/Main.check_radius, there's a call to (fromIntegral m), where
m is defined at top level. The full-laziness pass doesn't catch this because by
the time it runs, enough inlining has happened that it looks like
case ccall ... of (# a,b #) -> ...
and the full laziness pass doesn't float unboxed things.
* The same function is an excellent example of where liberate-case would be a win.
* Don't forget to try CSE
Interface files
~~~~~~~~~~~~~~~
* Don't need to pin a kind on the type variable in a interface class decl,
because it'll be correctly re-inferred when we read it in.
* The double semicolon at the end of an interface-file signature is so that
the lexer can run through the pragmas very fast when -O isn't being used.
* In export lists, T|(A,B) says that constructors A and B are exported,
but not the type T. Similarly for classes.
We can't say T(T,A,B) and T(A,B) to export or not-export T respectively,
because the type T might have a constructor T.
21 Oct 00
- Do we want to continue to record the package name in an interface file?
Does pi_mod have a Module or a ModuleName?
ghc/compiler/basicTypes/Id.lhs
View file @
aa44169c
...
...
@@ -70,8 +70,7 @@ module Id (
#include "HsVersions.h"
import CoreSyn ( Unfolding, CoreRules, CoreExpr, Expr(..),
AltCon (..), Alt, mkApps, Arg )
import CoreSyn ( Unfolding, CoreRules )
import BasicTypes ( Arity )
import Var ( Id, DictId,
isId, mkIdVar,
...
...
@@ -83,30 +82,23 @@ import Var ( Id, DictId,
)
import VarSet
import Type ( Type, tyVarsOfType, typePrimRep, addFreeTyVars,
seqType, splitAlgTyConApp_maybe, mkTyVarTy,
mkTyConApp, splitTyConApp_maybe)
seqType, splitTyConApp_maybe )
import IdInfo
import Demand ( Demand
, isStrict, wwLazy
)
import Demand ( Demand )
import Name ( Name, OccName,
mkSysLocalName, mkLocalName,
isUserExportedName, getOccName, isIPOcc
)
import OccName ( UserFS )
import PrimRep ( PrimRep )
import PrimOp ( PrimOp, primOpIsCheap )
import TysPrim ( statePrimTyCon )
import FieldLabel ( FieldLabel )
import SrcLoc ( SrcLoc )
import Unique ( Unique, mkBuiltinUnique, getBuiltinUniques,
getNumBuiltinUniques )
import Outputable
import TyCon ( TyCon, AlgTyConFlavour(..), ArgVrcs, mkSynTyCon,
mkAlgTyConRep, tyConName,
tyConTyVars, tyConDataCons )
import DataCon ( DataCon, dataConWrapId, dataConOrigArgTys )
import Var ( Var )
infixl 1 `setIdUnfolding`,
`setIdArityInfo`,
`setIdDemandInfo`,
...
...
ghc/compiler/basicTypes/IdInfo.lhs
View file @
aa44169c
...
...
@@ -80,7 +80,6 @@ import DataCon ( DataCon )
import FieldLabel ( FieldLabel )
import Demand -- Lots of stuff
import Outputable
import Maybe ( isJust )
infixl 1 `setDemandInfo`,
`setStrictnessInfo`,
...
...
ghc/compiler/basicTypes/Module.lhs
View file @
aa44169c
...
...
@@ -56,7 +56,7 @@ module Module
, elemModuleEnv, extendModuleEnv, extendModuleEnvList, plusModuleEnv_C
, delModuleEnvList, delModuleEnv, plusModuleEnv, lookupModuleEnv
, lookupWithDefaultModuleEnv, mapModuleEnv, mkModuleEnv, emptyModuleEnv
, rngModuleEnv, unitModuleEnv, isEmptyModuleEnv, foldModuleEnv
, rngModuleEnv, unitModuleEnv, isEmptyModuleEnv, foldModuleEnv
, lookupModuleEnvByName
) where
...
...
@@ -276,7 +276,8 @@ mapModuleEnv :: (a -> b) -> ModuleEnv a -> ModuleEnv b
rngModuleEnv :: ModuleEnv a -> [a]
isEmptyModuleEnv :: ModuleEnv a -> Bool
lookupModuleEnv :: ModuleEnv a -> Module -> Maybe a
lookupModuleEnv :: ModuleEnv a -> Module -> Maybe a
lookupModuleEnvByName:: ModuleEnv a -> ModuleName -> Maybe a
lookupWithDefaultModuleEnv :: ModuleEnv a -> a -> Module -> a
elemModuleEnv :: Module -> ModuleEnv a -> Bool
foldModuleEnv :: (a -> b -> b) -> b -> ModuleEnv a -> b
...
...
@@ -289,6 +290,7 @@ delModuleEnvList = delListFromUFM
delModuleEnv = delFromUFM
plusModuleEnv = plusUFM
lookupModuleEnv = lookupUFM
lookupModuleEnvByName = lookupUFM
lookupWithDefaultModuleEnv = lookupWithDefaultUFM
mapModuleEnv = mapUFM
mkModuleEnv = listToUFM
...
...
ghc/compiler/coreSyn/CoreFVs.lhs
View file @
aa44169c
...
...
@@ -22,7 +22,7 @@ import Id ( Id, idFreeTyVars, hasNoBinding, idSpecialisation )
import VarSet
import Var ( Var, isId )
import Name ( isLocallyDefined )
import Type ( tyVarsOfType
, Type
)
import Type ( tyVarsOfType )
import Util ( mapAndUnzip )
import Outputable
\end{code}
...
...
ghc/compiler/coreSyn/CoreUnfold.lhs
View file @
aa44169c
...
...
@@ -355,8 +355,6 @@ data ExprSize = TooBig
FastInt -- Size to subtract if result is scrutinised
-- by a case expression
isTooBig TooBig = True
isTooBig _ = False
maxSize TooBig _ = TooBig
maxSize _ TooBig = TooBig
...
...
ghc/compiler/coreSyn/CoreUtils.lhs
View file @
aa44169c
...
...
@@ -41,8 +41,8 @@ import PprCore ( pprCoreExpr )
import Var ( Var, isId, isTyVar )
import VarSet
import VarEnv
import Name (
isLocallyDefined,
hashName )
import Literal (
Literal,
hashLiteral, literalType, litIsDupable )
import Name ( hashName )
import Literal ( hashLiteral, literalType, litIsDupable )
import DataCon ( DataCon, dataConRepArity )
import PrimOp ( primOpOkForSpeculation, primOpIsCheap,
primOpIsDupable )
...
...
@@ -50,17 +50,16 @@ import Id ( Id, idType, idFlavour, idStrictness, idLBVarInfo,
mkWildId, idArity, idName, idUnfolding, idInfo,
isDataConId_maybe, isPrimOpId_maybe
)
import IdInfo ( arityLowerBound, InlinePragInfo(..),
LBVarInfo(..),
import IdInfo ( LBVarInfo(..),
IdFlavour(..),
megaSeqIdInfo )
import Demand ( appIsBottom )
import Type ( Type, mkFunTy, mkForAllTy,
splitFunTy_maybe,
tyVarsOfType, tyVarsOfTypes,
splitFunTy_maybe,
isNotUsgTy, mkUsgTy, unUsgTy, UsageAnn(..),
applyTys, isUnLiftedType, seqType
)
import TysWiredIn ( boolTy,
stringTy,
trueDataCon, falseDataCon )
import TysWiredIn ( boolTy, trueDataCon, falseDataCon )
import CostCentre ( CostCentre )
import Maybes ( maybeToBool )
import Outputable
...
...
@@ -702,8 +701,6 @@ noteSize InlineCall = 1
noteSize InlineMe = 1
noteSize (TermUsg usg) = usg `seq` 1
exprsSize = foldr ((+) . exprSize) 0
varSize :: Var -> Int
varSize b | isTyVar b = 1
| otherwise = seqType (idType b) `seq`
...
...
ghc/compiler/coreSyn/PprCore.lhs
View file @
aa44169c
...
...
@@ -23,11 +23,10 @@ import Id ( Id, idType, isDataConId_maybe, idLBVarInfo, idArity,
idInfo, idInlinePragma, idDemandInfo, idOccInfo
)
import Var ( isTyVar )
import IdInfo ( IdInfo, megaSeqIdInfo,
occInfo,
import IdInfo ( IdInfo, megaSeqIdInfo,
arityInfo, ppArityInfo, ppFlavourInfo, flavourInfo,
demand
Info,
spec
Info,
specInfo, cpr
Info,
ppCpr
Info,
strictnessInfo, ppStrictnessInfo, cafInfo, ppCafInfo,
cprInfo, ppCprInfo, lbvarInfo,
workerInfo, ppWorkerInfo
)
import DataCon ( dataConTyCon )
...
...
ghc/compiler/ghci/CmLink.lhs
View file @
aa44169c
...
...
@@ -13,17 +13,14 @@ module CmLink ( Linkable(..), Unlinked(..),
where
import StgInterp ( linkIModules, ClosureEnv, ItblEnv )
import Linker
import CmStaticInfo ( PackageConfigInfo )
import Module ( ModuleName, PackageName )
import InterpSyn ( UnlinkedIBind, HValue, binder )
import Module ( Module )
import Outputable ( SDoc )
import FiniteMap ( FiniteMap, emptyFM )
import RdrName ( RdrName )
import FiniteMap ( emptyFM )
import Digraph ( SCC(..) )
import Addr ( Addr )
import Outputable
import Panic ( panic )
...
...
ghc/compiler/hsSyn/HsBinds.lhs
View file @
aa44169c
...
...
@@ -16,7 +16,7 @@ import {-# SOURCE #-} HsMatches ( pprMatches, Match, pprGRHSs, GRHSs )
-- friends:
import HsTypes ( HsType )
import CoreSyn ( CoreExpr )
import PprCore ( {-
I
nstance
s
-} )
import PprCore ( {-
i
nstance
Outputable (Expr a)
-} )
--others:
import Name ( Name )
...
...
ghc/compiler/hsSyn/HsMatches.lhs
View file @
aa44169c
...
...
@@ -13,12 +13,11 @@ module HsMatches where
-- Friends
import HsExpr ( HsExpr, Stmt(..) )
import HsBinds ( HsBinds(..), nullBinds )
import HsTypes (
HsTyVarBndr,
HsType )
import HsTypes ( HsType )
-- Others
import Type ( Type )
import SrcLoc ( SrcLoc )
import Outputable
import HsPat ( InPat (..) )
import List
\end{code}
...
...
ghc/compiler/hsSyn/HsPat.lhs
View file @
aa44169c
...
...
@@ -27,7 +27,7 @@ import BasicTypes ( Fixity, Boxity, tupleParens )
-- others:
import Var ( Id, TyVar )
import DataCon ( DataCon, dataConTyCon )
import Name (
Name,
isDataSymOcc, getOccName, NamedThing )
import Name ( isDataSymOcc, getOccName, NamedThing )
import Maybes ( maybeToBool )
import Outputable
import TyCon ( maybeTyConSingleCon )
...
...
ghc/compiler/hsSyn/HsTypes.lhs
View file @
aa44169c
...
...
@@ -25,10 +25,9 @@ module HsTypes (
#include "HsVersions.h"
import {-# SOURCE #-} HsExpr ( HsExpr )
import Class ( FunDep )
import Type ( Type, Kind, PredType(..),
UsageAnn(..),
ClassContext,
getTyVar_maybe,
splitSigmaTy, unUsgTy, boxedTypeKind
import Type ( Type, Kind, PredType(..), ClassContext,
splitSigmaTy, unUsgTy, boxedTypeKind
)
import TypeRep ( Type(..), TyNote(..) ) -- toHsType sees the representation
import TyCon ( isTupleTyCon, tupleTyConBoxity, tyConArity )
...
...
@@ -37,9 +36,8 @@ import Name ( toRdrName )
import OccName ( NameSpace )
import Var ( TyVar, tyVarKind )
import PprType ( {- instance Outputable Kind -}, pprParendKind )
import BasicTypes ( Arity, Boxity(..), tupleParens )
import PrelNames ( mkTupConRdrName, listTyConKey, hasKey, Uniquable(..) )
import Maybes ( maybeToBool )
import BasicTypes ( Boxity(..), tupleParens )
import PrelNames ( mkTupConRdrName, listTyConKey, hasKey )
import FiniteMap
import Outputable
...
...
@@ -282,8 +280,6 @@ toHsTyVars tvs = map toHsTyVar tvs
toHsType :: Type -> HsType RdrName
toHsType ty = toHsType' (unUsgTy ty)
-- For now we just discard the usage
-- = case splitUsgTy ty of
-- (usg, tau) -> HsUsgTy (toHsUsg usg) (toHsType' tau)
toHsType' :: Type -> HsType RdrName
-- Called after the usage is stripped off
...
...
@@ -319,10 +315,6 @@ toHsPred (IParam n ty) = HsPIParam (toRdrName n) (toHsType ty)
toHsContext :: ClassContext -> HsContext RdrName
toHsContext cxt = [HsPClass (toRdrName cls) (map toHsType tys) | (cls,tys) <- cxt]
toHsUsg UsOnce = HsUsOnce
toHsUsg UsMany = HsUsMany
toHsUsg (UsVar v) = HsUsVar (toRdrName v)
toHsFDs :: [FunDep TyVar] -> [FunDep RdrName]
toHsFDs fds = [(map toRdrName ns, map toRdrName ms) | (ns,ms) <- fds]
\end{code}
...
...
ghc/compiler/main/DriverPipeline.hs
View file @
aa44169c
-----------------------------------------------------------------------------
-- $Id: DriverPipeline.hs,v 1.
4
2000/10/
17 11:50
:2
0
simon
mar
Exp $
-- $Id: DriverPipeline.hs,v 1.
5
2000/10/
23 09:03
:2
7
simon
pj
Exp $
--
-- GHC Driver
--
...
...
@@ -44,7 +44,7 @@ import Panic
import
Directory
import
System
import
IOExts
import
Posix
--
import Posix
commented out temp by SLPJ to get going on windows
import
Exception
import
IO
...
...
@@ -712,6 +712,12 @@ preprocess filename =
-- reading the OPTIONS pragma from the source file, and passing the
-- output of hsc through the C compiler.
-- The driver sits between 'compile' and 'hscMain', translating calls
-- to the former into calls to the latter, and results from the latter
-- into results from the former. It does things like preprocessing
-- the .hs file if necessary, and compiling up the .stub_c files to
-- generate Linkables.
compile
::
Finder
-- to find modules
->
ModSummary
-- summary, including source
->
Maybe
ModIFace
-- old interface, if available
...
...
@@ -719,6 +725,19 @@ compile :: Finder -- to find modules
->
PersistentCompilerState
-- persistent compiler state
->
IO
CompResult
data
CompResult
=
CompOK
ModDetails
-- new details (HST additions)
(
Maybe
(
ModIface
,
Linkable
))
-- summary and code; Nothing => compilation not reqd
-- (old summary and code are still valid)
PersistentCompilerState
-- updated PCS
(
Bag
WarnMsg
)
-- warnings
|
CompErrs
PersistentCompilerState
-- updated PCS
(
Bag
ErrMsg
)
-- errors
(
Bag
WarnMsg
)
-- warnings
compile
finder
summary
old_iface
hst
pcs
=
do
verb
<-
readIORef
verbose
when
verb
(
hPutStrLn
stderr
(
"compile: compiling "
++
...
...
ghc/compiler/main/Finder.lhs
View file @
aa44169c
...
...
@@ -13,6 +13,7 @@ module Finder (
#include "HsVersions.h"
import HscTyes ( Finder, ModuleLocation(..) )
import CmStaticInfo
import DriverPhases
import DriverState
...
...
@@ -34,22 +35,6 @@ lives in, so it can make a Module from a ModuleName, and (b) where the
source, interface, and object files for a module live.
\begin{code}
type Finder = ModuleName -> IO (Maybe (Module, ModuleLocation))
-- For a module in another package, the hs_file and obj_file
-- components of ModuleLocation are undefined.
-- The locations specified by a ModuleLocation may or may not
-- correspond to actual files yet: for example, even if the object
-- file doesn't exist, the ModuleLocation still contains the path to
-- where the object file will reside if/when it is created.
data ModuleLocation
= ModuleLocation {
hs_file :: FilePath,
hi_file :: FilePath,
obj_file :: FilePath
}
-- caches contents of package directories, never expunged
GLOBAL_VAR(pkgDirCache, Nothing, Maybe (FiniteMap String (PackageName, FilePath)))
...
...
ghc/compiler/main/HscMain.lhs
View file @
aa44169c
...
...
@@ -20,6 +20,7 @@ import SrcLoc ( mkSrcLoc )
import Rename ( renameModule )
import PrelInfo ( wiredInThings )
import MkIface ( writeIface )
import TcModule ( TcResults(..), typecheckModule )
import Desugar ( deSugar )
...
...
@@ -57,6 +58,19 @@ import StgInterp ( runStgI )
%************************************************************************
\begin{code}
data HscResult
= HscOK ModDetails -- new details (HomeSymbolTable additions)
(Maybe ModIface) -- new iface (if any compilation was done)
(Maybe String) -- generated stub_h filename (in /tmp)
(Maybe String) -- generated stub_c filename (in /tmp)
(Maybe [UnlinkedIBind]) -- interpreted code, if any
PersistentCompilerState -- updated PCS
(Bag WarnMsg) -- warnings
| HscErrs PersistentCompilerState -- updated PCS
(Bag ErrMsg) -- errors
(Bag WarnMsg) -- warnings
hscMain
:: DynFlags
-> ModSummary -- summary, including source filename
...
...
@@ -258,7 +272,7 @@ initPersistentRenamerState :: PersistentRenamerState
}
initOrigNames :: FiniteMap (ModuleName,OccName) Name
initOrigNames = grab knownKeyNames `plusFM` grab
wiredInNames
initOrigNames = grab knownKeyNames `plusFM` grab
(map getName wiredInThings)
where
grab names = foldl add emptyFM names
add env name = addToFM env (moduleName (nameModule name), nameOccName name) name
...
...
ghc/compiler/main/HscTypes.lhs
View file @
aa44169c
...
...
@@ -5,19 +5,23 @@
\begin{code}
module HscTypes (
Finder, ModuleLocation(..),
ModDetails(..), ModIface(..), GlobalSymbolTable,
HomeSymbolTable, PackageSymbolTable,
HomeIfaceTable, PackageIfaceTable,
VersionInfo(..),
TyThing(..), groupTyThings,
TypeEnv, extendTypeEnv, lookupTypeEnv,
lookupFixityEnv,
WhetherHasOrphans, ImportVersion,
ExportItem,
WhatsImported(..),
WhetherHasOrphans, ImportVersion, WhatsImported(..),
PersistentRenamerState(..), IsBootInterface, Avails, DeclsMap,
IfaceInsts, IfaceRules, DeprecationEnv,
IfaceInsts, IfaceRules, DeprecationEnv,
GatedDecl,
OrigNameEnv(..), OrigNameNameEnv, OrigNameIParamEnv,
AvailEnv, AvailInfo, GenAvailInfo(..),
PersistentCompilerState(..),
...
...
@@ -26,8 +30,6 @@ module HscTypes (
GlobalRdrEnv, RdrAvailInfo,
CompResult(..), HscResult(..),
-- Provenance
Provenance(..), ImportReason(..), PrintUnqualified,
pprNameProvenance, hasBetterProv
...
...
@@ -36,42 +38,64 @@ module HscTypes (
#include "HsVersions.h"
import RdrName ( RdrNameEnv, emptyRdrEnv )
import Name ( Name, NameEnv, NamedThing,
unitNameEnv, extendNameEnv, plusNameEnv,
emptyNameEnv,
unitNameEnv, extendNameEnv, plusNameEnv,
lookupNameEnv, emptyNameEnv, getName, nameModule,
nameSrcLoc )
import Module ( Module, ModuleName, ModuleEnv,
extendModuleEnv, lookupModuleEnv )
import Class ( Class )
import NameSet ( NameSet )
import OccName ( OccName )
import RdrName ( RdrNameEnv, emptyRdrEnv )
import Outputable ( SDoc )
import UniqFM ( UniqFM )
import FiniteMap ( FiniteMap, emptyFM, addToFM, lookupFM, foldFM )
import Bag ( Bag )
import Id ( Id )
import Module ( Module, ModuleName, ModuleEnv,
lookupModuleEnv )
import VarSet ( TyVarSet )
import VarEnv ( IdEnv, emptyVarEnv )
import BasicTypes ( Version, Fixity, defaultFixity )
import Id ( Id )
import Class ( Class )
import TyCon ( TyCon )
import ErrUtils ( ErrMsg, WarnMsg )
import
CmLink ( Linkable
)
import RdrHsSyn ( RdrNameInstDecl, RdrNameRuleDecl, RdrNameHsDecl,
RdrNameDeprecation, RdrNameFixitySig
)
import
Interp
Syn (
UnlinkedIBind
)
import
UniqSupply ( UniqSupply
)
import HsDecls ( DeprecTxt )
import
BasicTypes ( Version, Fixity
)
import HsSyn ( DeprecTxt
)
import
RdrHs
Syn
(
RdrNameHsDecl
)
import
RnHsSyn ( RenamedHsDecl
)
import CoreSyn ( CoreRule )
import NameSet ( NameSet )
import Type ( Type )
import Name ( emptyNameEnv )
import VarSet ( TyVarSet )
import Panic ( panic )
import FiniteMap ( FiniteMap, emptyFM, addToFM, lookupFM, foldFM )
import Bag ( Bag )
import UniqFM ( UniqFM )
import Outputable
import SrcLoc ( SrcLoc, isGoodSrcLoc )
import Util ( thenCmp )
import RnHsSyn ( RenamedHsDecl )
\end{code}
%************************************************************************
%* *
\subsection{The Finder type}
%* *
%************************************************************************
\begin{code}
type Finder = ModuleName -> IO (Maybe (Module, ModuleLocation))
data ModuleLocation
= ModuleLocation {
hs_file :: FilePath,
hi_file :: FilePath,
obj_file :: FilePath
}
\end{code}
For a module in another package, the hs_file and obj_file
components of ModuleLocation are undefined.
The locations specified by a ModuleLocation may or may not
correspond to actual files yet: for example, even if the object
file doesn't exist, the ModuleLocation still contains the path to
where the object file will reside if/when it is created.
%************************************************************************
%* *
\subsection{Symbol tables and Module details}
...
...
@@ -147,7 +171,6 @@ Simple lookups in the symbol table.
\begin{code}
lookupFixityEnv :: IfaceTable -> Name -> Maybe Fixity
-- Returns defaultFixity if there isn't an explicit fixity
lookupFixityEnv tbl name
= case lookupModuleEnv tbl (nameModule name) of
Nothing -> Nothing
...
...
@@ -225,10 +248,14 @@ but they are mostly elaborated elsewhere
\begin{code}
data VersionInfo
= VersionInfo {
modVers :: Version,
fixVers :: Version,
ruleVers :: Version,
declVers :: NameEnv Version
vers_module :: Version, -- Changes when anything changes
vers_exports :: Version, -- Changes when export list changes
vers_rules :: Version, -- Changes when any rule changes
vers_decls :: NameEnv Version
-- Versions for "big" names only (not data constructors, class ops)
-- The version of an Id changes if its fixity changes
-- Ditto data constructors, class operations, except that the version of
-- the parent class/tycon changes
}
type DeprecationEnv = NameEnv DeprecTxt -- Give reason for deprecation
...
...
@@ -268,14 +295,6 @@ type AvailEnv = NameEnv AvailInfo -- Maps a Name to the AvailInfo that contain
%************************************************************************
\begin{code}
type ExportItem = (ModuleName, [RdrAvailInfo])
type ImportVersion name = (ModuleName, WhetherHasOrphans, IsBootInterface, WhatsImported name)
type ModVersionInfo = (Version, -- Version of the whole module
Version, -- Version number for all fixity decls together
Version) -- ...ditto all rules together
type WhetherHasOrphans = Bool
-- An "orphan" is
-- * an instance decl in a module other than the defn module for
...
...
@@ -285,25 +304,31 @@ type WhetherHasOrphans = Bool
type IsBootInterface = Bool
type ImportVersion name = (ModuleName, WhetherHasOrphans, IsBootInterface, WhatsImported name)
data WhatsImported name = NothingAtAll -- The module is below us in the
-- hierarchy, but we import nothing
| Everything Version -- The module version
| Everything Version -- Used for modules from other packages;
-- we record only the module's version number
| Specifically
Version -- Module version
(Maybe Version) -- Export-list version, if we depend on it
[(name,Version)] -- List guaranteed non-empty
Version -- Rules version
| Specifically Version -- Module version
Version -- Fixity version
Version -- Rules version
[(name,Version)] -- List guaranteed non-empty
deriving( Eq )
-- 'Specifically' doesn't let you say "I imported f but none of the
fixiti
es in
-- the module". If you use anything in the module you get its
fixity and
rule version
-- So if the
fixities or
rules change, you'll recompile, even if you don't use
ei
the
r
.
-- 'Specifically' doesn't let you say "I imported f but none of the
rul
es in
-- the module". If you use anything in the module you get its rule version
-- So if the rules change, you'll recompile, even if you don't use the
m
.
-- This is easy to implement, and it's safer: you might not have used the rules last
-- time round, but if someone has added a new rule you might need it this time
-- 'Everything' means there was a "module M" in
-- this module's export list, so we just have to go by M's version,
-- not the list of (name,version) pairs
-- The export list field is (Just v) if we depend on the export list:
-- we imported the module without saying exactly what we imported
-- We need to recompile if the module exports changes, because we might
-- now have a name clash in the importing module.
\end{code}
...
...
@@ -316,6 +341,8 @@ data WhatsImported name = NothingAtAll -- The module is below us in the
\begin{code}
data PersistentCompilerState
= PCS {
pcs_PIT :: PackageIfaceTable, -- Domain = non-home-package modules
-- the mi_decls component is empty
pcs_PST :: PackageSymbolTable, -- Domain = non-home-package modules
-- except that the InstEnv components is empty
pcs_insts :: InstEnv, -- The total InstEnv accumulated from all
...
...
@@ -393,47 +420,6 @@ type GatedDecl = (NameSet, (Module, RdrNameHsDecl))
\end{code}
%************************************************************************
%* *
\subsection{The result of compiling one module}
%* *
%************************************************************************
\begin{code}
data CompResult
= CompOK ModDetails -- new details (HST additions)
(Maybe (ModIface, Linkable))
-- summary and code; Nothing => compilation not reqd
-- (old summary and code are still valid)