Execute an action of type IO [a], returning ForeignHValues for
each of the results.
Moduleghc-9.10.3GHC2021
GHC.Runtime.Interpreter
Interacting with the iserv interpreter, whether it is running on an external process or in the current process.
- 5 types
- 47 values
- Packageghc-9.10.3
- Exports52
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceInterpreter.hs
High-level interface to the interpreter
26 declarationsConstructors
Instances4Show, Generic, Binary, Rep
Show a => Show (EvalStatus_ a b)Defined in ghci-9.10.3 · GHCi.MessageGeneric (EvalStatus_ a b)Defined in ghci-9.10.3 · GHCi.MessageBinary a => Binary (EvalStatus_ a b)Defined in ghci-9.10.3 · GHCi.Messagetype Rep (EvalStatus_ a b) = D1 ('MetaDataDefined in ghci-9.10.3 · GHCi.Message"EvalStatus_"
"GHCi.Message"
"ghci-9.10.3-e3f8"
'False) (C1 ('MetaCons"EvalComplete"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (EvalResult a))) :+: C1 ('MetaCons"EvalBreak"
'PrefixI 'False) ((S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HValueRef) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe EvalBreakpoint))) :*: (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RemoteRef (ResumeContext b))) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RemotePtr CostCentreStack)))))
Constructors
Instances4Show, Generic, Binary, Rep
Show a => Show (EvalResult a)Defined in ghci-9.10.3 · GHCi.MessageGeneric (EvalResult a)Defined in ghci-9.10.3 · GHCi.MessageBinary a => Binary (EvalResult a)Defined in ghci-9.10.3 · GHCi.Messagetype Rep (EvalResult a) = D1 ('MetaDataDefined in ghci-9.10.3 · GHCi.Message"EvalResult"
"GHCi.Message"
"ghci-9.10.3-e3f8"
'False) (C1 ('MetaCons"EvalException"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SerializableException)) :+: C1 ('MetaCons"EvalSuccess"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
We can pass simple expressions to EvalStmt, consisting of values and application. This allows us to wrap the statement to be executed in another function, which is used by GHCi to implement :set args and :set prog. It might be worthwhile to extend this little language in the future.
Instances4Show, Generic, Binary, Rep
Show a => Show (EvalExpr a)Defined in ghci-9.10.3 · GHCi.MessageGeneric (EvalExpr a)Defined in ghci-9.10.3 · GHCi.MessageBinary a => Binary (EvalExpr a)Defined in ghci-9.10.3 · GHCi.Messagetype Rep (EvalExpr a) = D1 ('MetaDataDefined in ghci-9.10.3 · GHCi.Message"EvalExpr"
"GHCi.Message"
"ghci-9.10.3-e3f8"
'False) (C1 ('MetaCons"EvalThis"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons"EvalApp"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (EvalExpr a)) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (EvalExpr a))))
Execute an action of type IO ()
Execute an action of type IO String
Execute an action of type String -> IO String
Allocate and store the given bytes in memory, returning a pointer to the memory in the remote process.
Create a set of BCOs that may be mutually recursive.
Send a Seq message to the iserv process to force a value #2950
Interpreter uses Dynamic way
Interpreter uses Profiling way
The object-code linker
25 declarationsloadDLL loads a dynamic library using the OS's native linker (i.e. dlopen() on Unix, LoadLibrary() on Windows). It takes either an absolute pathname to the file, or a relative filename (e.g. "libfoo.so" or "foo.dll"). In the latter case, loadDLL searches the standard locations for the appropriate library.
Run a command in the interpreter's context. With
-fexternal-interpreter, the command is serialized and sent to an
external iserv process, and the response is deserialized (hence the
Binary constraint). With -fno-external-interpreter we execute
the command directly here.
Grab a lock on the IServ and do something with it. Overloaded because this is used from TcM as well as IO.
Spawn JS interpreter if it isn't already running and execute the given action
Update the interpreter state.
Stop the interpreter
Creates a ForeignRef that will automatically release the RemoteRef when it is no longer referenced.
Convert a ForeignRef to the value it references directly. This
only works when the interpreter is running in the same process as
the compiler, so it fails when -fexternal-interpreter is on.
Convert an RemoteRef to the value it references directly. This
only works when the interpreter is running in the same process as
the compiler, so it fails when -fexternal-interpreter is on.
Reexport for convenience
1 declarationA Message a is a message that returns a value of type a.
These are requests sent from GHC to the server.
Constructors
Shutdown :: Message ()Exit the iserv process
RtsRevertCAFs :: Message ()InitLinker :: Message ()LookupSymbol :: String -> Message (Maybe (RemotePtr ()))LookupSymbolInDLL :: RemotePtr LoadedDLL -> String -> Message (Maybe (RemotePtr ()))LookupClosure :: String -> Message (Maybe HValueRef)LoadDLL :: String -> Message (Either String (RemotePtr LoadedDLL))LoadArchive :: String -> Message ()LoadObj :: String -> Message ()UnloadObj :: String -> Message ()AddLibrarySearchPath :: String -> Message (RemotePtr ())RemoveLibrarySearchPath :: RemotePtr () -> Message BoolResolveObjs :: Message BoolFindSystemLibrary :: String -> Message (Maybe String)CreateBCOs :: [ResolvedBCO] -> Message [HValueRef]Create a set of BCO objects, and return HValueRefs to them See
createBCOsin compilerGHCRuntime/Interpreter.hs. NB: this has a custom Binary behavior, see Note [Parallelize CreateBCOs serialization]FreeHValueRefs :: [HValueRef] -> Message ()Release HValueRefs
AddSptEntry :: Fingerprint -> HValueRef -> Message ()Add entries to the Static Pointer Table
MallocData :: ByteString -> Message (RemotePtr ())Malloc some data and return a RemotePtr to it
MallocStrings :: [ByteString] -> Message [RemotePtr ()]PrepFFI :: FFIConv -> [FFIType] -> FFIType -> Message (RemotePtr C_ffi_cif)Calls
GHCi.FFI.prepareForeignCallFreeFFI :: RemotePtr C_ffi_cif -> Message ()Free data previously created by PrepFFI
MkConInfoTable :: Bool -> Int -> Int -> Int -> Int -> ByteString -> Message (RemotePtr StgInfoTable)Create an info table for a constructor
EvalStmt :: EvalOpts -> EvalExpr HValueRef -> Message (EvalStatus_ [HValueRef] [HValueRef])Evaluate a statement
ResumeStmt :: EvalOpts -> RemoteRef (ResumeContext [HValueRef]) -> Message (EvalStatus_ [HValueRef] [HValueRef])Resume evaluation of a statement after a breakpoint
AbandonStmt :: RemoteRef (ResumeContext [HValueRef]) -> Message ()Abandon evaluation of a statement after a breakpoint
EvalString :: HValueRef -> Message (EvalResult String)Evaluate something of type
IO StringEvalStringToString :: HValueRef -> String -> Message (EvalResult String)Evaluate something of type
String -> IO StringEvalIO :: HValueRef -> Message (EvalResult ())Evaluate something of type
IO ()MkCostCentres :: String -> [(String, String)] -> Message [RemotePtr CostCentre]Create a set of CostCentres with the same module name
CostCentreStackInfo :: RemotePtr CostCentreStack -> Message [String]Show a CostCentreStack as a
[String]NewBreakArray :: Int -> Message (RemoteRef BreakArray)Create a new array of breakpoint flags
SetupBreakpoint :: RemoteRef BreakArray -> Int -> Int -> Message ()Set how many times a breakpoint should be ignored also used for enable/disable
BreakpointStatus :: RemoteRef BreakArray -> Int -> Message BoolQuery the status of a breakpoint (True = enabled)
GetBreakpointVar :: HValueRef -> Int -> Message (Maybe HValueRef)Get a reference to a free variable at a breakpoint
StartTH :: Message (RemoteRef (IORef QState))Start a new TH module, return a state token that should be
RunTH :: RemoteRef (IORef QState) -> HValueRef -> THResultType -> Maybe Loc -> Message (QResult ByteString)Evaluate a TH computation.
Returns a ByteString, because we have to force the result before returning it to ensure there are no errors lurking in it. The TH types don't have NFData instances, and even if they did, we have to serialize the value anyway, so we might as well serialize it to force it.
RunModFinalizers :: RemoteRef (IORef QState) -> [RemoteRef (Q ())] -> Message (QResult ())Run the given mod finalizers.
GetClosure :: HValueRef -> Message (GenClosure HValueRef)Remote interface to GHC.Exts.Heap.getClosureData. This is used by the GHCi debugger to inspect values in the heap for :print and type reconstruction.
Seq :: HValueRef -> Message (EvalStatus_ () ())Evaluate something. This is used to support :force in GHCi.
ResumeSeq :: RemoteRef (ResumeContext ()) -> Message (EvalStatus_ () ())Resume forcing a free variable in a breakpoint (#2950)
NewBreakModule :: String -> Message (RemotePtr BreakModule)Allocate a string for a breakpoint module name. This uses an empty dummy type because
ModuleNameisn't available here.