unload,
PersistentLinkerState{-abstractly!-}, emptyPLS,
#ifdef GHCI
+ delListFromClosureEnv,
+ addListToClosureEnv,
linkExpr
#endif
) where
+#ifdef GHCI
+import ByteCodeLink ( linkIModules, linkIExpr )
+#endif
+
import Interpreter
import DriverPipeline
import CmTypes
-import CmStaticInfo ( GhciMode(..) )
+import HscTypes ( GhciMode(..) )
import Outputable ( SDoc )
import Digraph ( SCC(..), flattenSCC )
+import Name ( Name )
import Module ( ModuleName )
import FiniteMap
import Outputable
import ErrUtils ( showPass )
import CmdLineOpts ( DynFlags(..) )
-import Panic ( panic, GhcException(..) )
+import Panic ( panic )
-import Exception
import List
import Monad
import IO
emptyPLS = return (PersistentLinkerState {})
#endif
+#ifdef GHCI
+delListFromClosureEnv :: PersistentLinkerState -> [Name]
+ -> IO PersistentLinkerState
+delListFromClosureEnv pls names
+ = return pls{ closure_env = delListFromFM (closure_env pls) names }
+
+addListToClosureEnv :: PersistentLinkerState -> [(Name,HValue)]
+ -> IO PersistentLinkerState
+addListToClosureEnv pls new_bindings
+ = return pls{ closure_env = addListToFM (closure_env pls) new_bindings }
+#endif
+
-----------------------------------------------------------------------------
-- Unloading old objects ready for a new compilation sweep.
--
--
-- * otherwise, we unload it.
--
+-- * we also implicitly unload all temporary bindings at this point.
unload :: GhciMode
-> DynFlags
linkObjs (objs ++ bcos) pls
-- get the objects first
-ppLinkableSCC :: SCC Linkable -> SDoc
-ppLinkableSCC = ppr . flattenSCC
-
filterModuleLinkables :: (ModuleName -> Bool) -> [Linkable] -> [Linkable]
filterModuleLinkables p [] = []
filterModuleLinkables p (li:lis)
#ifndef GHCI
linkObjs = panic "CmLink.linkObjs: no interpreter"
-lookupClosure = panic "CmLink.lookupClosure: no interpreter"
#else
linkObjs [] pls = linkFinish pls []
linkObjs (l@(LM _ m uls) : ls) pls
linkInterpretedCode ls (uls++ul_trees)
pls{objects_loaded = l : objects_loaded pls}
| any isObject uls
- = throwDyn (OtherError
- "can't link object code that depends on interpreted code")
+ = panic "linkInterpretedCode: trying to link object code to interpreted code"
| otherwise = invalidLinkable
invalidLinkable = panic "CmLink: linkable doesn't contain entirely objects or interpreted code"