ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Runtime.Interpreter.Types

Contents

- IServ
- JSInterp

Description

Types used by the runtime interpreter

Synopsis

- data Interp = Interp {
  - interpInstance :: !InterpInstance
  - interpLoader :: !Loader
  }
- data InterpInstance = ExternalInterp !ExtInterp
- data InterpProcess = InterpProcess {
  - interpPipe :: !Pipe
  - interpHandle :: !ProcessHandle
  }
- data ExtInterp
  - = ExtIServ !IServ
  - | ExtJS !JSInterp
- type ExtInterpStatusVar d = MVar (InterpStatus (ExtInterpInstance d))
- data ExtInterpInstance c = ExtInterpInstance {
  - instProcess :: !InterpProcess
  - instPendingFrees :: !(MVar [HValueRef])
  - instLookupSymbolCache :: !(MVar (UniqFM FastString (Ptr ())))
  - instExtra :: !c
  }
- data ExtInterpState cfg details = ExtInterpState {
  - interpConfig :: !cfg
  - interpStatus :: !(ExtInterpStatusVar details)
  }
- data InterpStatus inst
  - = InterpPending
  - | InterpRunning !inst
- type IServ = ExtInterpState IServConfig ()
- data IServConfig = IServConfig {
  - iservConfProgram :: !String
  - iservConfOpts :: ![String]
  - iservConfProfiled :: !Bool
  - iservConfDynamic :: !Bool
  - iservConfHook :: !(Maybe (CreateProcess -> IO ProcessHandle))
  - iservConfTrace :: IO ()
  }
- type JSInterp = ExtInterpState JSInterpConfig JSInterpExtra
- data JSInterpExtra = JSInterpExtra {
  - instStdIn :: !Handle
  - instFinderCache :: !FinderCache
  - instFinderOpts :: !FinderOpts
  - instJSState :: !(MVar JSState)
  - instGhciUnitId :: !UnitId
  }
- data JSInterpConfig = JSInterpConfig {
  - jsInterpNodeConfig :: !NodeJsSettings
  - jsInterpScript :: !FilePath
  - jsInterpTmpFs :: !TmpFs
  - jsInterpTmpDir :: !TempDir
  - jsInterpLogger :: !Logger
  - jsInterpCodegenCfg :: !StgToJSConfig
  - jsInterpUnitEnv :: !UnitEnv
  - jsInterpFinderOpts :: !FinderOpts
  - jsInterpFinderCache :: !FinderCache
  }
- data JSState = JSState {
  - jsLinkState :: !LinkPlan
  - jsServerStarted :: !Bool
  }
- data NodeJsSettings = NodeJsSettings {
  - nodeProgram :: FilePath
  - nodePath :: Maybe FilePath
  - nodeExtraArgs :: [String]
  - nodeKeepAliveMaxMem :: Integer
  }
- defaultNodeJsSettings :: NodeJsSettings

# Documentation

data Interp #

Interpreter

Constructors

Interp |
Fields interpInstance :: !InterpInstance Interpreter instance (internal, external) interpLoader :: !Loader Interpreter loader

data InterpInstance #

Constructors

ExternalInterp !ExtInterp | External interpreter

data InterpProcess #

Constructors

InterpProcess |
Fields interpPipe :: !Pipe Pipe to communicate with the server interpHandle :: !ProcessHandle Process handle of the server

data ExtInterp #

Constructors

ExtIServ !IServ |
ExtJS !JSInterp |

type ExtInterpStatusVar d = MVar (InterpStatus (ExtInterpInstance d)) #

data ExtInterpInstance c #

Common field between native external interpreter and the JS one

Constructors

ExtInterpInstance |
Fields instProcess :: !InterpProcess External interpreter process and its pipe (communication channel) instPendingFrees :: !(MVar [HValueRef]) Values that need to be freed before the next command is sent. Finalizers for ForeignRefs can append values to this list asynchronously. instLookupSymbolCache :: !(MVar (UniqFM FastString (Ptr ()))) LookupSymbol cache instExtra :: !c Instance specific extra fields

data ExtInterpState cfg details #

External interpreter

The external interpreter is spawned lazily (on first use) to avoid slowing down sessions that don't require it. The contents of the MVar reflects the state of the interpreter (running or not).

Constructors

ExtInterpState |
Fields interpConfig :: !cfg interpStatus :: !(ExtInterpStatusVar details)

data InterpStatus inst #

Status of an external interpreter

Constructors

InterpPending | Not spawned yet
InterpRunning !inst | Running

# IServ

type IServ = ExtInterpState IServConfig () #

data IServConfig #

Configuration needed to spawn an external interpreter

Constructors

IServConfig |
Fields iservConfProgram :: !String External program to run iservConfOpts :: ![String] Command-line options iservConfProfiled :: !Bool Use Profiling way iservConfDynamic :: !Bool Use Dynamic way iservConfHook :: !(Maybe (CreateProcess -> IO ProcessHandle)) Hook iservConfTrace :: IO () Trace action executed after spawn

# JSInterp

type JSInterp = ExtInterpState JSInterpConfig JSInterpExtra #

data JSInterpExtra #

Constructors

JSInterpExtra |
Fields instStdIn :: !Handle Stdin for the process instFinderCache :: !FinderCache instFinderOpts :: !FinderOpts instJSState :: !(MVar JSState) Mutable state instGhciUnitId :: !UnitId GHCi unit-id

data JSInterpConfig #

Constructors

JSInterpConfig |
Fields jsInterpNodeConfig :: !NodeJsSettings NodeJS settings jsInterpScript :: !FilePath Path to "ghc-interp.js" script jsInterpTmpFs :: !TmpFs jsInterpTmpDir :: !TempDir jsInterpLogger :: !Logger jsInterpCodegenCfg :: !StgToJSConfig jsInterpUnitEnv :: !UnitEnv jsInterpFinderOpts :: !FinderOpts jsInterpFinderCache :: !FinderCache

data JSState #

Constructors

JSState |
Fields jsLinkState :: !LinkPlan Linker state of the interpreter jsServerStarted :: !Bool Is the Haskell server started?

data NodeJsSettings #

NodeJs configuration

Constructors

NodeJsSettings |
Fields nodeProgram :: FilePath location of node.js program nodePath :: Maybe FilePath value of NODE_PATH environment variable (search path for Node modules; GHCJS used to provide some) nodeExtraArgs :: [String] extra arguments to pass to node.js nodeKeepAliveMaxMem :: Integer keep node.js (TH, GHCJSi) processes alive if they don't use more than this

defaultNodeJsSettings :: NodeJsSettings #