Safe Haskell | None |
---|---|
Language | Haskell2010 |
Stg.Machine.Types
Contents
Description
Types used in the execution of the STG machine.
- data StgState = StgState {}
- data StgStateStyle = StgStateStyle {
- headline :: Doc -> Doc
- address :: Doc -> Doc
- addressCore :: Doc -> Doc
- closureType :: Doc -> Doc
- stackFrameType :: Doc -> Doc
- data StackFrame
- newtype MemAddr = MemAddr Int
- data Value
- data Code
- data Mapping k v = Mapping k v
- newtype Globals = Globals (Map Var Value)
- newtype Locals = Locals (Map Var Value)
- data Closure = Closure LambdaForm [Value]
- newtype Heap = Heap (Map MemAddr HeapObject)
- data HeapObject
- data Info = Info InfoShort [InfoDetail]
- data InfoShort
- data InfoDetail
- = Detail_FunctionApplication Var [Atom]
- | Detail_UnusedLocalVariables [Var] Locals
- | Detail_EnterNonUpdatable MemAddr [Mapping Var Value]
- | Detail_EvalLet [Var] [MemAddr]
- | Detail_EvalCase
- | Detail_ReturnCon_Match Constr [Var]
- | Detail_ReturnConDefBound Var MemAddr
- | Detail_ReturnIntDefBound Var Integer
- | Detail_EnterUpdatable MemAddr
- | Detail_ConUpdate Constr MemAddr
- | Detail_PapUpdate MemAddr
- | Detail_ReturnIntCannotUpdate
- | Detail_StackNotEmpty
- | Detail_GarbageCollected Text (Set MemAddr) (Map MemAddr MemAddr)
- | Detail_EnterBlackHole MemAddr Integer
- | Detail_UpdateClosureWithPrimitive
- | Detail_BadConArity
- data StateTransition
- = Enter_NonUpdatableClosure
- | Enter_PartiallyAppliedUpdate
- | Enter_UpdatableClosure
- | Eval_AppC
- | Eval_AppP
- | Eval_Case
- | Eval_Case_Primop_Normal
- | Eval_Case_Primop_DefaultBound
- | Eval_FunctionApplication
- | Eval_Let Rec
- | Eval_Lit
- | Eval_LitApp
- | ReturnCon_DefBound
- | ReturnCon_DefUnbound
- | ReturnCon_Match
- | ReturnCon_Update
- | ReturnInt_DefBound
- | ReturnInt_DefUnbound
- | ReturnInt_Match
- data StateError
- newtype NotInScope = NotInScope [Var]
Documentation
The internal state of an STG.
Constructors
StgState | |
Fields
|
data StgStateStyle Source
Package of style definitions used in this module.
Constructors
StgStateStyle | |
Fields
|
data StackFrame Source
Constructors
ArgumentFrame Value | Argument frames store values on the argument stack, so that they can later be retrieved when the calling function can be applied to them. |
ReturnFrame Alts Locals | Return frames are used when the scrutinee of a case expression is done being evaluated, and the branch to continue on has to be decided. |
UpdateFrame MemAddr | When an updatable closure is entered, an update frame with its heap address is created. Once its computation finishes, its heap entry is updated with the computed value. |
A memory address.
A value of the STG machine.
The different code states the STG can be in.
The global environment consists of the mapping from top-level definitions to their respective values.
The global environment consists if the mapping from local definitions to their respective values.
A closure is a lambda form, together with the values of its free variables.
Constructors
Closure LambdaForm [Value] |
The heap stores closures addressed by memory location.
Constructors
Heap (Map MemAddr HeapObject) |
data HeapObject Source
Constructors
HClosure Closure | |
Blackhole Integer | When an updatable closure is entered, it is overwritten by a black hole. This has two main benefits:
To make the black hole a bit more transparent, it is tagged with the STG tick in which it was introduced. This tag is used only for display purposes. |
State information
User-facing information about the current state of the STG.
Constructors
Info InfoShort [InfoDetail] |
Short machine status info. This field may be used programmatically, in particular it tells the stepper whether the machine has halted.
Constructors
NoRulesApply | There is no valid state transition to continue with. |
MaxStepsExceeded | The machine did not halt within a number of steps. Used by
|
HaltedByPredicate | The machine halted because a user-specified halting predicate held. |
StateError StateError | The machine halted in a state that is known to be invalid, there is no valid state transition to continue with. An example of this would be a |
StateTransition StateTransition | Description of the state transition that lead to the current state. |
StateInitial | Used to mark the initial state of the machine. |
GarbageCollection | A garbage collection step, in which no ordinary evaluation is done. |
data InfoDetail Source
Constructors
data StateTransition Source
Constructors
data StateError Source