Safe Haskell | None |
---|---|
Language | Haskell2010 |
Stg.Machine.Types
Contents
Description
Types used in the execution of the STG machine.
- data StgState = StgState {}
- data StgiAnn
- 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
- = Rule1_Eval_FunctionApplication
- | Rule2_Enter_NonUpdatableClosure
- | Rule3_Eval_Let Rec
- | Rule4_Eval_Case
- | Rule5_Eval_AppC
- | Rule6_ReturnCon_Match
- | Rule7_ReturnCon_DefUnbound
- | Rule8_ReturnCon_DefBound
- | Rule9_Lit
- | Rule10_LitApp
- | Rule11_ReturnInt_Match
- | Rule12_ReturnInt_DefBound
- | Rule13_ReturnInt_DefUnbound
- | Rule14_Eval_AppP
- | Rule15_Enter_UpdatableClosure
- | Rule16_ReturnCon_Update
- | Rule17_Enter_PartiallyAppliedUpdate
- | Rule17a_Enter_PartiallyAppliedUpdate
- | Rule1819_Eval_Case_Primop_Shortcut
- data StateError
- newtype NotInScope = NotInScope [Var]
Documentation
The internal state of an STG.
Constructors
StgState | |
Fields
|
data StackFrame Source #
Stack frames unify arguments, returns, and updates.
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.
A single key -> value association.
Used to make 2-tuples to be inserted into association maps clearer.
Constructors
Mapping k v |
Instances
(Eq v, Eq k) => Eq (Mapping k v) Source # | |
(Ord v, Ord k) => Ord (Mapping k v) Source # | |
(Show v, Show k) => Show (Mapping k v) Source # | |
Generic (Mapping k v) Source # | |
(NFData k, NFData v) => NFData (Mapping k v) Source # | |
(PrettyStgi k, PrettyStgi v) => PrettyStgi (Mapping k v) Source # | |
type Rep (Mapping k v) Source # | |
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 #
Heap objects are what is stored on the heap. The most common and also most important one are closures.
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. |
Instances
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 #
Used to store meta-information about state transitions in order to be rendered as a helpful hint.
Constructors
Instances
data StateTransition Source #
Classifies which rule has been applied in order to reach the current state.
Constructors
data StateError Source #
Like StateTransition
, but for invalid transitions.
Constructors
Instances
newtype NotInScope Source #
Type safety wrapper to report variables that were not in scope.
Constructors
NotInScope [Var] |