Crate asm

Source
Expand description

Assembly for the Essential VM.

§Op Table

OpcodeOpShort Description
0x01Stack PushPush one word onto the stack.
0x02Stack PopPop one word from the stack.
0x03Stack DupDuplicate the top word on the stack.
0x04Stack DupFromDuplicate the word at the given stack depth index.
0x05Stack SwapSwap top two words on stack.
0x06Stack SwapIndexSwap the top word on the stack with the word at the given stack depth index.
0x07Stack SelectConditionally keep one of the top two elements on the stack.
0x08Stack SelectRangeConditionally keep one of the top two ranges on the stack.
0x09Stack RepeatRepeat a section of code the number of times.
0x0AStack RepeatEndIncrement or decrements the top counter on the repeat stack.
0x0BStack ReserveReserve space on the stack for len words.
0x0CStack LoadLoad the value at the given stack depth index relative to the bottom.
0x0DStack StoreStore the value at the given stack depth index relative to the bottom.
0x0EStack DropDrop the top n elements from the stack.
0x10Pred EqCheck equality of two words.
0x11Pred EqRangeCheck equality of two ranges on the stack.
0x12Pred GtCheck if left-hand side is greater than right-hand side.
0x13Pred LtCheck if left-hand side is less than right-hand side.
0x14Pred GteCheck if left-hand side is greater than or equal to right-hand side.
0x15Pred LteCheck if left-hand side is less than or equal to right-hand side.
0x16Pred AndLogical AND of two words.
0x17Pred OrLogical OR of two words.
0x18Pred NotLogical NOT of a word.
0x19Pred EqSetPop two sets off the stack and check if they are equal.
0x1APred BitAndBitwise AND of two words.
0x1BPred BitOrBitwise OR of two words.
0x20Alu AddAdd two words.
0x21Alu SubSubtract two words.
0x22Alu MulMultiply two words.
0x23Alu DivInteger division.
0x24Alu ModModulus of lhs by rhs.
0x25Alu ShlLogical shift left by number of bits.
0x26Alu ShrLogical shift right by number of bits.
0x27Alu ShrIArithmetic shift right by number of bits.
0x30Access ThisAddressGet the content hash of this predicate.
0x31Access ThisContractAddressGet the content hash of the contract this predicate belongs to.
0x38Access RepeatCounterAccess the top repeat counters current value.
0x3AAccess PredicateDataAccess a range of len words starting from value_ix within the
0x3BAccess PredicateDataLenGet the length of a the predicate data value located at slot_ix.
0x3CAccess PredicateDataSlotsGet the number of predicate data slots.
0x3DAccess PredicateExistsCheck if a solution to a predicate exists within the same solution
0x50Crypto Sha256Produce a SHA 256 hash from the specified data.
0x51Crypto VerifyEd25519Validate an Ed25519 signature against a public key.
0x52Crypto RecoverSecp256k1Recover the public key from a secp256k1 signature.
0x60TotalControlFlow HaltEnd the execution of the program.
0x61TotalControlFlow HaltIfHalt the program if the value is true.
0x62TotalControlFlow JumpIfJump the given number of instructions if the value is true.
0x63TotalControlFlow PanicIfPanic if the condition is true.
0x70Memory AllocAllocate a new block of memory to the end.
0x71Memory FreeTruncate memory to the specified new length, freeing all that follows.
0x72Memory LoadLoad the value at the given index from memory onto the stack.
0x73Memory StoreStore the value at the given index within memory.
0x74Memory LoadRangeLoad a range of words starting at the index within memory.
0x75Memory StoreRangeStore a range of words starting at the index within memory.
0x7AParentMemory LoadLoad the value at the given index from parent memory onto the stack.
0x7BParentMemory LoadRangeLoad a range of words starting at the index within parent memory.
0x80StateRead KeyRangeRead a range of values at each key from state starting at the key
0x81StateRead KeyRangeExternRead a range of values at each key from external state starting at the key
0x82StateRead PostKeyRangeRead a range of values at each key from post state starting at the key
0x83StateRead PostKeyRangeExternRead a range of values at each key from external post state starting at the key
0x90Compute ComputeHand off execution to compute threads until ComputeEnd operation is encountered.
0x91Compute ComputeEndEnd of the execution of the compute program.

Modules§

bytes_iter
Provides the operation type bytes iterators.
effects
Determine the effects of a program.
opcode
Typed representation of the opcode, without any associated data.
short
Short hand names for the operations.

Structs§

InvalidOpcodeError
An attempt to parse a byte as an opcode failed.
NotEnoughBytesError
An error occurring within Opcode::parse_op in the case that the provided bytes iterator contains insufficient bytes for the expected associated operation data.

Enums§

Access
Operations for accessing input data.
Alu
Operations for computing arithmetic and logic.
Compute
Operations related to VM compute execution.
Crypto
Operations providing cryptographic functionality.
FromBytesError
Errors that can occur while parsing ops from bytes.
Memory
Operations for memory.
Op
All operations available to the Essential VM execution.
Opcode
All operations available to the Essential VM execution.
ParentMemory
Operations for reading parent memory from within a compute context.
Pred
Operations for computing predicates.
Stack
Operations related to stack manipulation.
StateRead
Operations related to reading state.
TotalControlFlow
Control flow operations that keep the program total.

Traits§

ToBytes
Operation types that may be converted to their serialized form in bytes.
ToOpcode
Allows for converting an Op into its associated Opcode.
TryFromBytes
Operation types that may be parsed from a bytecode representation.

Functions§

from_bytes
Parse operations from the given iterator yielding bytes.
to_bytes
Convert the given iterator yielding operations into and iterator yielding the serialized form in bytes.

Type Aliases§

Word
Single unit of data.