| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Wrench.Isa.Wasm32.State
Description
The machine's state and every primitive that touches it: where code, data and the two stacks sit in memory, the counted word/byte accessors, and the operand and control stacks -- the latter including the binary format of a control record, since the format and the LIFO discipline that gives it meaning are one thing.
Synopsis
- data Wasm32St w = Wasm32St {
- pc :: Int
- sp :: Int
- frameBase :: Int
- localCount :: Int
- ctrlSp :: Int
- stackRoot :: Int
- scanCache :: ![(Int, Int)]
- scanCacheSize :: Int
- branchCache :: ![BranchEntry w]
- branchCacheSize :: Int
- tosRegs :: ![(Int, w)]
- tosRegCount :: Int
- mem :: IoMem (Wasm32Isa w w) w
- ir :: [(Int, Wasm32Isa w w)]
- stopped :: Bool
- internalError :: Maybe Text
- defaultStackRoot :: IoMem (Wasm32Isa w w) w -> Int
- getWord :: IsWord w => Int -> State (Wasm32St w) w
- setWord :: IsWord w => Int -> w -> State (Wasm32St w) ()
- fetchInstructionAt :: IsWord w => Int -> State (Wasm32St w) (Either Text (Wasm32Isa w w))
- getByte :: IsWord w => Int -> State (Wasm32St w) Word8
- setByte :: IsWord w => Int -> Word8 -> State (Wasm32St w) ()
- setPc :: Int -> State (Wasm32St w) ()
- nextPc :: Wasm32Isa w w -> State (Wasm32St w) ()
- raiseInternalError :: Text -> State (Wasm32St w) ()
- pushValue :: IsWord w => w -> State (Wasm32St w) ()
- popValue :: IsWord w => State (Wasm32St w) w
- localAddr :: IsWord w => Int -> State (Wasm32St w) Int
- reserveLocals :: IsWord w => Int -> State (Wasm32St w) ()
- cachedScan :: Int -> State (Wasm32St w) (Either Text Int) -> State (Wasm32St w) (Either Text Int)
- data BranchEntry w = BranchEntry {}
- cachedBranch :: IsWord w => Int -> Int -> State (Wasm32St w) (Maybe (BranchEntry w))
- rememberBranch :: IsWord w => BranchEntry w -> State (Wasm32St w) ()
- data Scope
- = LoopScope { }
- | BlockScope { }
- | CallScope { }
- pushScope :: IsWord w => Scope -> State (Wasm32St w) ()
- retireScopes :: IsWord w => Int -> State (Wasm32St w) ()
- scopeAtDepth :: IsWord w => Int -> State (Wasm32St w) (Maybe (Either Text Scope))
- scopeRecordAtDepth :: IsWord w => Int -> State (Wasm32St w) (Maybe (Int, [w]))
- innermostCall :: IsWord w => State (Wasm32St w) (Either Text (Int, Scope))
- ctrlCorruptedErr :: Int -> Text -> Text
- scopeAddrs :: IsWord w => Wasm32St w -> [Int]
- scopeRecordBytes :: IsWord w => Int
- scopeWordAddrs :: IsWord w => Int -> [Int]
The state
The machine state.
Constructors
| Wasm32St | |
Fields
| |
Instances
| Show w => Show (Wasm32St w) Source # | |||||||||
| IsWord w => InitState (Wasm32St w) Source # | |||||||||
| IsWord w => Inspectable (Wasm32St w) Source # | |||||||||
Defined in Wrench.Isa.Wasm32.Report Associated Types
| |||||||||
| IsWord w => Machine (Wasm32St w) (Wasm32Isa w w) w Source # | |||||||||
| type IsaOf (Wasm32St w) Source # | |||||||||
Defined in Wrench.Isa.Wasm32.Report | |||||||||
| type MemOf (Wasm32St w) Source # | |||||||||
Defined in Wrench.Isa.Wasm32.State | |||||||||
| type WordOf (Wasm32St w) Source # | |||||||||
Defined in Wrench.Isa.Wasm32.Report | |||||||||
Memory map
Memory access
Operand stack
Locals
Scan cache
cachedScan :: Int -> State (Wasm32St w) (Either Text Int) -> State (Wasm32St w) (Either Text Int) Source #
Branch cache
data BranchEntry w Source #
A taken br or br_if: where it was, the control record it read and
that record's words, and where it went.
Constructors
| BranchEntry | |
Instances
| Show w => Show (BranchEntry w) Source # | |
Defined in Wrench.Isa.Wasm32.State Methods showsPrec :: Int -> BranchEntry w -> ShowS # show :: BranchEntry w -> String # showList :: [BranchEntry w] -> ShowS # | |
cachedBranch :: IsWord w => Int -> Int -> State (Wasm32St w) (Maybe (BranchEntry w)) Source #
rememberBranch :: IsWord w => BranchEntry w -> State (Wasm32St w) () Source #
Control stack
Constructors
| LoopScope | |
| BlockScope | |
| CallScope | |
Fields
| |
Control-record encoding
scopeRecordBytes :: IsWord w => Int Source #