Enum aluvm::isa::Instr

source ·
#[non_exhaustive]
pub enum Instr<Extension = ReservedOp>where Extension: InstructionSet,{
Show 13 variants ControlFlow(ControlFlowOp), Put(PutOp), Move(MoveOp), Cmp(CmpOp), Arithmetic(ArithmeticOp), Bitwise(BitwiseOp), Bytes(BytesOp), Digest(DigestOp), Secp256k1(Secp256k1Op), Curve25519(Curve25519Op), ExtensionCodes(Extension), ReservedInstruction(ReservedOp), Nop,
}
Expand description

Full set of instructions

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ControlFlow(ControlFlowOp)

Control-flow instructions. See ControlFlowOp for the details.

§

Put(PutOp)

Instructions setting register values. See PutOp for the details.

§

Move(MoveOp)

Instructions moving and swapping register values. See PutOp for the details.

§

Cmp(CmpOp)

Instructions comparing register values. See CmpOp for the details.

§

Arithmetic(ArithmeticOp)

Arithmetic instructions. See ArithmeticOp for the details.

§

Bitwise(BitwiseOp)

Bit operations & boolean algebra instructions. See BitwiseOp for the details.

§

Bytes(BytesOp)

Operations on byte strings. See BytesOp for the details.

§

Digest(DigestOp)

Cryptographic hashing functions. See DigestOp for the details.

§

Secp256k1(Secp256k1Op)

Operations on Secp256k1 elliptic curve. See Secp256k1Op for the details.

§

Curve25519(Curve25519Op)

Operations on Curve25519 elliptic curve. See Curve25519Op for the details.

§

ExtensionCodes(Extension)

Extension operations which can be provided by a host environment provided via generic parameter

§

ReservedInstruction(ReservedOp)

Reserved instruction for fututre use in core ALU ISA.

Currently equal to ControlFlowOp::Fail.

§

Nop

No-operation instruction.

Trait Implementations§

source§

impl<Extension> Bytecode for Instr<Extension>where Extension: InstructionSet,

source§

fn byte_count(&self) -> u16

Returns number of bytes which instruction and its argument occupies
source§

fn instr_range() -> RangeInclusive<u8>

Returns range of instruction btecodes covered by a set of operations
source§

fn instr_byte(&self) -> u8

Returns byte representing instruction code (without its arguments)
source§

fn call_site(&self) -> Option<LibSite>

If the instruction call or references any external library, returns the call site in that library.
source§

fn encode_args<W>(&self, writer: &mut W) -> Result<(), BytecodeError>where W: Write,

Writes instruction arguments as bytecode, omitting instruction code byte
source§

fn decode<R>(reader: &mut R) -> Result<Self, CodeEofError>where R: Read,

Reads the instruction from bytecode
source§

fn encode<W>(&self, writer: &mut W) -> Result<(), BytecodeError>where W: Write,

Writes the instruction as bytecode
source§

impl<Extension> Clone for Instr<Extension>where Extension: InstructionSet + Clone,

source§

fn clone(&self) -> Instr<Extension>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Extension> Debug for Instr<Extension>where Extension: InstructionSet + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Extension> Display for Instr<Extension>where Extension: InstructionSet,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Extension> Hash for Instr<Extension>where Extension: InstructionSet + Hash,

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<Extension> InstructionSet for Instr<Extension>where Extension: InstructionSet,

§

type Context<'ctx> = <Extension as InstructionSet>::Context<'ctx>

Context: external data which are accessible to the ISA.
source§

fn isa_ids() -> BTreeSet<&'static str>

ISA Extensions used by the provided instruction set. Read more
source§

fn exec( &self, regs: &mut CoreRegs, site: LibSite, ctx: &Self::Context<'_> ) -> ExecStep

Executes given instruction taking all registers as input and output. Read more
source§

fn isa_string() -> String

ISA Extension IDs represented as a standard string (space-separated) Read more
source§

fn isa_id() -> Box<[u8]>

ISA Extension IDs encoded in a standard way (space-separated) Read more
source§

fn is_supported(id: &str) -> bool

Checks whether provided ISA extension ID is supported by the current instruction set
source§

fn complexity(&self) -> u64

Returns computational complexity of the instruction
source§

impl<Extension> PartialEq for Instr<Extension>where Extension: InstructionSet + PartialEq,

source§

fn eq(&self, other: &Instr<Extension>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Extension> Eq for Instr<Extension>where Extension: InstructionSet + Eq,

source§

impl<Extension> StructuralEq for Instr<Extension>where Extension: InstructionSet,

source§

impl<Extension> StructuralPartialEq for Instr<Extension>where Extension: InstructionSet,

Auto Trait Implementations§

§

impl<Extension> RefUnwindSafe for Instr<Extension>where Extension: RefUnwindSafe,

§

impl<Extension> Send for Instr<Extension>where Extension: Send,

§

impl<Extension> Sync for Instr<Extension>where Extension: Sync,

§

impl<Extension> Unpin for Instr<Extension>where Extension: Unpin,

§

impl<Extension> UnwindSafe for Instr<Extension>where Extension: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.