From e21b5f3296615c0daf6c2d602ac91b76a84ad3c1 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 17 Oct 2000 11:52:10 +0000 Subject: [PATCH] [project @ 2000-10-17 11:52:10 by simonmar] - remove CmCompile; all its contents have moved to HscTypes and DriverPipeline. - export Unlinked(..) from CmLink - update CompManager w.r.t. new CmSummarise --- ghc/compiler/ghci/CmCompile.lhs | 163 ------------------------------------- ghc/compiler/ghci/CmLink.lhs | 2 +- ghc/compiler/ghci/CompManager.lhs | 8 +- 3 files changed, 6 insertions(+), 167 deletions(-) delete mode 100644 ghc/compiler/ghci/CmCompile.lhs diff --git a/ghc/compiler/ghci/CmCompile.lhs b/ghc/compiler/ghci/CmCompile.lhs deleted file mode 100644 index 4081c53..0000000 --- a/ghc/compiler/ghci/CmCompile.lhs +++ /dev/null @@ -1,163 +0,0 @@ -% -% (c) The University of Glasgow, 2000 -% -\section[CmCompile]{Compiler for GHCI} - -\begin{code} -module CmCompile ( cmCompile, - ModDetails, -- abstract - ModIFace, -- abstract - PersistentCompilerState, emptyPCS, -- abstract - HomeSymbolTable, -- not abstract (CM needs to see it) - HomeInterfaceTable, -- ditto - CompResult(..) - ) -where - -#include "HsVersions.h" - --- many of these need to be moved to HscTypes ---import CmLink ( Linkable(..) ) ---import Outputable ( SDoc ) ---import CmFind ( Finder ) ---import CmSummarise ( ModSummary, name_of_summary ) ---import FiniteMap ( FiniteMap, emptyFM ) - ---import Module ( Module ) ---import RnMonad ( Avails, GlobalRdrEnv, DeclsMap, --- WhetherHasOrphans, ImportVersion, --- IfaceInsts, IfaceRules, ExportItem ) ---import TcEnv ( TyThing, InstEnv ) ---import Name ( Name, OccName ) ---import BasicTypes ( Fixity, Version ) ---import Id ( Id ) ---import CoreSyn ( CoreRule ) ---import RdrHsSyn ( RdrNameDeprecation, RdrNameRuleDecl, RdrNameFixitySig, --- RdrNameHsDecl, RdrNameInstDecl ) - -import HscTypes ( ) - -\end{code} - - -%************************************************************************ -%* * -\subsection{The main compiler interface} -%* * -%************************************************************************ - - -\begin{code} -cmCompile :: Finder -- to find modules - -> ModSummary -- summary, including source - -> Maybe ModIFace -- old interface, if available - -> HomeModMap -- ModuleName -> Module - -> HomeSymbolTable -- for home module ModDetails - -> PersistentCompilerState -- IN: persistent compiler state - -> IO CompResult - -cmCompile finder summary old_iface hst pcs - = do putStrLn ("cmCompile: compiling " ++ name_of_summary summary) - return (CompOK (error "cmCompile:modDetails") - (Just (error "cmCompile:modIFace", - --error "cmCompile:Linkable" - --LM (name_of_summary summary) [] - LM (name_of_summary summary) [] - )) - pcs - [] - ) - -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 - [SDoc] -- warnings - - | CompErrs PersistentCompilerState -- updated PCS - [SDoc] -- errors - [SDoc] -- warnings - - --- These two are only here to avoid recursion between CmCompile and --- CompManager. They really ought to be in the latter. -type ModuleEnv a = UniqFM a -- Domain is Module - -type HomeModMap = FiniteMap ModuleName Module -- domain: home mods only -type HomeSymbolTable = ModuleEnv ModDetails -- ditto -type HomeInterfaceTable = ModuleEnv ModIFace -\end{code} - - -%************************************************************************ -%* * -\subsection{Module details} -%* * -%************************************************************************ - -A @ModDetails@ summarises everything we know about a compiled module - -Auxiliary definitions - -\begin{code} -{- I DONT think this should be here -- should be in HscTypes -type DeprecationEnv = NameEnv DeprecTxt -- Give reason for deprecation - -type GlobalRdrEnv = RdrNameEnv [Name] -- The list is because there may be name clashes - -- These only get reported on lookup, - -- not on construction - -data GenAvailInfo name = Avail name -- An ordinary identifier - | AvailTC name -- The name of the type or class - [name] -- The available pieces of type/class. - -- NB: If the type or class is itself - -- to be in scope, it must be in this list. - -- Thus, typically: AvailTC Eq [Eq, ==, /=] - deriving( Eq ) - -- Equality used when deciding if the interface has changed - -type AvailEnv = NameEnv AvailInfo -- Maps a Name to the AvailInfo that contains it -type AvailInfo = GenAvailInfo Name -type RdrAvailInfo = GenAvailInfo OccName -type Avails = [AvailInfo] --} -\end{code} - - -%************************************************************************ -%* * -\subsection{The persistent compiler state} -%* * -%************************************************************************ - -\begin{code} -data PersistentCompilerState - = PCS { - pcs_PST :: PackageSymbolTable, -- Domain = non-home-package modules - pcsHP :: RnMonad.HoldingPen, -- Pre-slurped interface bits and pieces - pcsNS :: NameSupply -- Allocate uniques for names - } - -type PackageSymbolTable = ModuleEnv ModDetails - -data NameSupply - = NS { nsUniqs :: UniqSupply, - nsNames :: FiniteMap (Module,OccName) Name -- Ensures that one original name gets one unique - nsIParam :: FiniteMap OccName Name -- Ensures that one implicit parameter name gets one unique - } -======= ->>>>>>> 1.9 -======= - --- should be somewhere else? -emptyPCS :: IO PersistentCompilerState -emptyPCS = return (PersistentCompilerState - { pcs_modmap = emptyFM, - pcs_pit = emptyPIT, - pcs_pst = emptyPST, - pcs_hp = emptyHoldingPen }) ->>>>>>> 1.10 -\end{code} - diff --git a/ghc/compiler/ghci/CmLink.lhs b/ghc/compiler/ghci/CmLink.lhs index fa180a8..c7ee69f 100644 --- a/ghc/compiler/ghci/CmLink.lhs +++ b/ghc/compiler/ghci/CmLink.lhs @@ -4,7 +4,7 @@ \section[CmLink]{Linker for GHCI} \begin{code} -module CmLink ( Linkable(..), +module CmLink ( Linkable(..), Unlinked(..), filterModuleLinkables, modname_of_linkable, is_package_linkable, LinkResult(..), diff --git a/ghc/compiler/ghci/CompManager.lhs b/ghc/compiler/ghci/CompManager.lhs index e658466..90ef10c 100644 --- a/ghc/compiler/ghci/CompManager.lhs +++ b/ghc/compiler/ghci/CompManager.lhs @@ -501,9 +501,11 @@ downsweep rootNm finder where getSummary :: ModName -> IO ModSummary getSummary nm - = do loc <- finder nm - summary <- summarise loc - return summary + = do found <- finder nm + case found of + Just (mod, location) -> summarise mod location + Nothing -> panic ("CompManager: can't find module `" ++ + showSDoc (ppr nm) ++ "'") -- loop invariant: homeSummaries doesn't contain package modules loop :: [ModSummary] -> IO [ModSummary] -- 1.7.10.4