pulley_interpreter::op

Enum Op

Source
pub enum Op {
Show 72 variants Ret(Ret), Call(Call), CallIndirect(CallIndirect), Jump(Jump), BrIf(BrIf), BrIfNot(BrIfNot), BrIfXeq32(BrIfXeq32), BrIfXneq32(BrIfXneq32), BrIfXslt32(BrIfXslt32), BrIfXslteq32(BrIfXslteq32), BrIfXult32(BrIfXult32), BrIfXulteq32(BrIfXulteq32), BrIfXeq64(BrIfXeq64), BrIfXneq64(BrIfXneq64), BrIfXslt64(BrIfXslt64), BrIfXslteq64(BrIfXslteq64), BrIfXult64(BrIfXult64), BrIfXulteq64(BrIfXulteq64), BrTable32(BrTable32), Xmov(Xmov), Fmov(Fmov), Vmov(Vmov), Xconst8(Xconst8), Xconst16(Xconst16), Xconst32(Xconst32), Xconst64(Xconst64), Xadd32(Xadd32), Xadd64(Xadd64), Xeq64(Xeq64), Xneq64(Xneq64), Xslt64(Xslt64), Xslteq64(Xslteq64), Xult64(Xult64), Xulteq64(Xulteq64), Xeq32(Xeq32), Xneq32(Xneq32), Xslt32(Xslt32), Xslteq32(Xslteq32), Xult32(Xult32), Xulteq32(Xulteq32), Load32U(Load32U), Load32S(Load32S), Load64(Load64), Load32UOffset8(Load32UOffset8), Load32SOffset8(Load32SOffset8), Load64Offset8(Load64Offset8), Load32UOffset64(Load32UOffset64), Load32SOffset64(Load32SOffset64), Load64Offset64(Load64Offset64), Store32(Store32), Store64(Store64), Store32SOffset8(Store32SOffset8), Store64Offset8(Store64Offset8), Store32SOffset64(Store32SOffset64), Store64Offset64(Store64Offset64), PushFrame(PushFrame), PopFrame(PopFrame), XPush32(XPush32), XPush32Many(XPush32Many), XPush64(XPush64), XPush64Many(XPush64Many), XPop32(XPop32), XPop32Many(XPop32Many), XPop64(XPop64), XPop64Many(XPop64Many), BitcastIntFromFloat32(BitcastIntFromFloat32), BitcastIntFromFloat64(BitcastIntFromFloat64), BitcastFloatFromInt32(BitcastFloatFromInt32), BitcastFloatFromInt64(BitcastFloatFromInt64), StackAlloc32(StackAlloc32), StackFree32(StackFree32), ExtendedOp(ExtendedOp),
}
Expand description

A complete, materialized operation/instruction.

This type is useful for debugging, writing tests, etc… but is not actually ever used by the interpreter, encoder, or decoder, all of which avoid materializing ops.

Variants§

§

Ret(Ret)

Transfer control the address in the lr register.

§

Call(Call)

Transfer control to the PC at the given offset and set the lr register to the PC just after this instruction.

§

CallIndirect(CallIndirect)

Transfer control to the PC in reg and set lr to the PC just after this instruction.

§

Jump(Jump)

Unconditionally transfer control to the PC at the given offset.

§

BrIf(BrIf)

Conditionally transfer control to the given PC offset if cond contains a non-zero value.

§

BrIfNot(BrIfNot)

Conditionally transfer control to the given PC offset if cond contains a zero value.

§

BrIfXeq32(BrIfXeq32)

Branch if a == b.

§

BrIfXneq32(BrIfXneq32)

Branch if a != b.

§

BrIfXslt32(BrIfXslt32)

Branch if signed a < b.

§

BrIfXslteq32(BrIfXslteq32)

Branch if signed a <= b.

§

BrIfXult32(BrIfXult32)

Branch if unsigned a < b.

§

BrIfXulteq32(BrIfXulteq32)

Branch if unsigned a <= b.

§

BrIfXeq64(BrIfXeq64)

Branch if a == b.

§

BrIfXneq64(BrIfXneq64)

Branch if a != b.

§

BrIfXslt64(BrIfXslt64)

Branch if signed a < b.

§

BrIfXslteq64(BrIfXslteq64)

Branch if signed a <= b.

§

BrIfXult64(BrIfXult64)

Branch if unsigned a < b.

§

BrIfXulteq64(BrIfXulteq64)

Branch if unsigned a <= b.

§

BrTable32(BrTable32)

Branch to the label indicated by idx.

After this instruction are amt instances of PcRelOffset and the idx selects which one will be branched to. The value of idx is clamped to amt - 1 (e.g. the last offset is the “default” one.

§

Xmov(Xmov)

Move between x registers.

§

Fmov(Fmov)

Move between f registers.

§

Vmov(Vmov)

Move between v registers.

§

Xconst8(Xconst8)

Set dst = sign_extend(imm8).

§

Xconst16(Xconst16)

Set dst = sign_extend(imm16).

§

Xconst32(Xconst32)

Set dst = sign_extend(imm32).

§

Xconst64(Xconst64)

Set dst = imm64.

§

Xadd32(Xadd32)

32-bit wrapping addition: low32(dst) = low32(src1) + low32(src2).

The upper 32-bits of dst are unmodified.

§

Xadd64(Xadd64)

64-bit wrapping addition: dst = src1 + src2.

§

Xeq64(Xeq64)

64-bit equality.

§

Xneq64(Xneq64)

64-bit inequality.

§

Xslt64(Xslt64)

64-bit signed less-than.

§

Xslteq64(Xslteq64)

64-bit signed less-than-equal.

§

Xult64(Xult64)

64-bit unsigned less-than.

§

Xulteq64(Xulteq64)

64-bit unsigned less-than-equal.

§

Xeq32(Xeq32)

32-bit equality.

§

Xneq32(Xneq32)

32-bit inequality.

§

Xslt32(Xslt32)

32-bit signed less-than.

§

Xslteq32(Xslteq32)

32-bit signed less-than-equal.

§

Xult32(Xult32)

32-bit unsigned less-than.

§

Xulteq32(Xulteq32)

32-bit unsigned less-than-equal.

§

Load32U(Load32U)

dst = zero_extend(load32(ptr))

§

Load32S(Load32S)

dst = sign_extend(load32(ptr))

§

Load64(Load64)

dst = load64(ptr)

§

Load32UOffset8(Load32UOffset8)

dst = zero_extend(load32(ptr + offset8))

§

Load32SOffset8(Load32SOffset8)

dst = sign_extend(load32(ptr + offset8))

§

Load64Offset8(Load64Offset8)

dst = load64(ptr + offset8)

§

Load32UOffset64(Load32UOffset64)

dst = zero_extend(load32(ptr + offset64))

§

Load32SOffset64(Load32SOffset64)

dst = sign_extend(load32(ptr + offset64))

§

Load64Offset64(Load64Offset64)

dst = load64(ptr + offset64)

§

Store32(Store32)

*ptr = low32(src)

§

Store64(Store64)

*ptr = src

§

Store32SOffset8(Store32SOffset8)

*(ptr + sign_extend(offset8)) = low32(src)

§

Store64Offset8(Store64Offset8)

*(ptr + sign_extend(offset8)) = src

§

Store32SOffset64(Store32SOffset64)

*(ptr + sign_extend(offset64)) = low32(src)

§

Store64Offset64(Store64Offset64)

*(ptr + sign_extend(offset64)) = src

§

PushFrame(PushFrame)

push lr; push fp; fp = sp

§

PopFrame(PopFrame)

sp = fp; pop fp; pop lr

§

XPush32(XPush32)

*sp = low32(src); sp = sp.checked_add(4)

§

XPush32Many(XPush32Many)

for src in srcs { xpush32 src }

§

XPush64(XPush64)

*sp = src; sp = sp.checked_add(8)

§

XPush64Many(XPush64Many)

for src in srcs { xpush64 src }

§

XPop32(XPop32)

*dst = *sp; sp -= 4

§

XPop32Many(XPop32Many)

for dst in dsts.rev() { xpop32 dst }

§

XPop64(XPop64)

*dst = *sp; sp -= 8

§

XPop64Many(XPop64Many)

for dst in dsts.rev() { xpop64 dst }

§

BitcastIntFromFloat32(BitcastIntFromFloat32)

low32(dst) = bitcast low32(src) as i32

§

BitcastIntFromFloat64(BitcastIntFromFloat64)

dst = bitcast src as i64

§

BitcastFloatFromInt32(BitcastFloatFromInt32)

low32(dst) = bitcast low32(src) as f32

§

BitcastFloatFromInt64(BitcastFloatFromInt64)

dst = bitcast src as f64

§

StackAlloc32(StackAlloc32)

sp = sp.checked_sub(amt)

§

StackFree32(StackFree32)

sp = sp + amt

§

ExtendedOp(ExtendedOp)

An extended operation/instruction.

Implementations§

Source§

impl Op

Source

pub fn encode<E>(&self, into: &mut E)
where E: Extend<u8>,

Available on crate feature encode only.

Encode this op into the given sink.

Trait Implementations§

Source§

impl<'arbitrary> Arbitrary<'arbitrary> for Op

Source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl Clone for Op

Source§

fn clone(&self) -> Op

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 Debug for Op

Source§

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

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

impl From<BitcastFloatFromInt32> for Op

Source§

fn from(op: BitcastFloatFromInt32) -> Self

Converts to this type from the input type.
Source§

impl From<BitcastFloatFromInt64> for Op

Source§

fn from(op: BitcastFloatFromInt64) -> Self

Converts to this type from the input type.
Source§

impl From<BitcastIntFromFloat32> for Op

Source§

fn from(op: BitcastIntFromFloat32) -> Self

Converts to this type from the input type.
Source§

impl From<BitcastIntFromFloat64> for Op

Source§

fn from(op: BitcastIntFromFloat64) -> Self

Converts to this type from the input type.
Source§

impl From<BrIf> for Op

Source§

fn from(op: BrIf) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfNot> for Op

Source§

fn from(op: BrIfNot) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXeq32> for Op

Source§

fn from(op: BrIfXeq32) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXeq64> for Op

Source§

fn from(op: BrIfXeq64) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXneq32> for Op

Source§

fn from(op: BrIfXneq32) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXneq64> for Op

Source§

fn from(op: BrIfXneq64) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXslt32> for Op

Source§

fn from(op: BrIfXslt32) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXslt64> for Op

Source§

fn from(op: BrIfXslt64) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXslteq32> for Op

Source§

fn from(op: BrIfXslteq32) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXslteq64> for Op

Source§

fn from(op: BrIfXslteq64) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXult32> for Op

Source§

fn from(op: BrIfXult32) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXult64> for Op

Source§

fn from(op: BrIfXult64) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXulteq32> for Op

Source§

fn from(op: BrIfXulteq32) -> Self

Converts to this type from the input type.
Source§

impl From<BrIfXulteq64> for Op

Source§

fn from(op: BrIfXulteq64) -> Self

Converts to this type from the input type.
Source§

impl From<BrTable32> for Op

Source§

fn from(op: BrTable32) -> Self

Converts to this type from the input type.
Source§

impl From<Call> for Op

Source§

fn from(op: Call) -> Self

Converts to this type from the input type.
Source§

impl From<CallIndirect> for Op

Source§

fn from(op: CallIndirect) -> Self

Converts to this type from the input type.
Source§

impl From<CallIndirectHost> for Op

Source§

fn from(op: CallIndirectHost) -> Self

Converts to this type from the input type.
Source§

impl From<ExtendedOp> for Op

Source§

fn from(op: ExtendedOp) -> Self

Converts to this type from the input type.
Source§

impl From<Fmov> for Op

Source§

fn from(op: Fmov) -> Self

Converts to this type from the input type.
Source§

impl From<Jump> for Op

Source§

fn from(op: Jump) -> Self

Converts to this type from the input type.
Source§

impl From<Load32S> for Op

Source§

fn from(op: Load32S) -> Self

Converts to this type from the input type.
Source§

impl From<Load32SOffset64> for Op

Source§

fn from(op: Load32SOffset64) -> Self

Converts to this type from the input type.
Source§

impl From<Load32SOffset8> for Op

Source§

fn from(op: Load32SOffset8) -> Self

Converts to this type from the input type.
Source§

impl From<Load32U> for Op

Source§

fn from(op: Load32U) -> Self

Converts to this type from the input type.
Source§

impl From<Load32UOffset64> for Op

Source§

fn from(op: Load32UOffset64) -> Self

Converts to this type from the input type.
Source§

impl From<Load32UOffset8> for Op

Source§

fn from(op: Load32UOffset8) -> Self

Converts to this type from the input type.
Source§

impl From<Load64> for Op

Source§

fn from(op: Load64) -> Self

Converts to this type from the input type.
Source§

impl From<Load64Offset64> for Op

Source§

fn from(op: Load64Offset64) -> Self

Converts to this type from the input type.
Source§

impl From<Load64Offset8> for Op

Source§

fn from(op: Load64Offset8) -> Self

Converts to this type from the input type.
Source§

impl From<Nop> for Op

Source§

fn from(op: Nop) -> Self

Converts to this type from the input type.
Source§

impl From<PopFrame> for Op

Source§

fn from(op: PopFrame) -> Self

Converts to this type from the input type.
Source§

impl From<PushFrame> for Op

Source§

fn from(op: PushFrame) -> Self

Converts to this type from the input type.
Source§

impl From<Ret> for Op

Source§

fn from(op: Ret) -> Self

Converts to this type from the input type.
Source§

impl From<StackAlloc32> for Op

Source§

fn from(op: StackAlloc32) -> Self

Converts to this type from the input type.
Source§

impl From<StackFree32> for Op

Source§

fn from(op: StackFree32) -> Self

Converts to this type from the input type.
Source§

impl From<Store32> for Op

Source§

fn from(op: Store32) -> Self

Converts to this type from the input type.
Source§

impl From<Store32SOffset64> for Op

Source§

fn from(op: Store32SOffset64) -> Self

Converts to this type from the input type.
Source§

impl From<Store32SOffset8> for Op

Source§

fn from(op: Store32SOffset8) -> Self

Converts to this type from the input type.
Source§

impl From<Store64> for Op

Source§

fn from(op: Store64) -> Self

Converts to this type from the input type.
Source§

impl From<Store64Offset64> for Op

Source§

fn from(op: Store64Offset64) -> Self

Converts to this type from the input type.
Source§

impl From<Store64Offset8> for Op

Source§

fn from(op: Store64Offset8) -> Self

Converts to this type from the input type.
Source§

impl From<Trap> for Op

Source§

fn from(op: Trap) -> Self

Converts to this type from the input type.
Source§

impl From<Vmov> for Op

Source§

fn from(op: Vmov) -> Self

Converts to this type from the input type.
Source§

impl From<XPop32> for Op

Source§

fn from(op: XPop32) -> Self

Converts to this type from the input type.
Source§

impl From<XPop32Many> for Op

Source§

fn from(op: XPop32Many) -> Self

Converts to this type from the input type.
Source§

impl From<XPop64> for Op

Source§

fn from(op: XPop64) -> Self

Converts to this type from the input type.
Source§

impl From<XPop64Many> for Op

Source§

fn from(op: XPop64Many) -> Self

Converts to this type from the input type.
Source§

impl From<XPush32> for Op

Source§

fn from(op: XPush32) -> Self

Converts to this type from the input type.
Source§

impl From<XPush32Many> for Op

Source§

fn from(op: XPush32Many) -> Self

Converts to this type from the input type.
Source§

impl From<XPush64> for Op

Source§

fn from(op: XPush64) -> Self

Converts to this type from the input type.
Source§

impl From<XPush64Many> for Op

Source§

fn from(op: XPush64Many) -> Self

Converts to this type from the input type.
Source§

impl From<Xadd32> for Op

Source§

fn from(op: Xadd32) -> Self

Converts to this type from the input type.
Source§

impl From<Xadd64> for Op

Source§

fn from(op: Xadd64) -> Self

Converts to this type from the input type.
Source§

impl From<Xconst16> for Op

Source§

fn from(op: Xconst16) -> Self

Converts to this type from the input type.
Source§

impl From<Xconst32> for Op

Source§

fn from(op: Xconst32) -> Self

Converts to this type from the input type.
Source§

impl From<Xconst64> for Op

Source§

fn from(op: Xconst64) -> Self

Converts to this type from the input type.
Source§

impl From<Xconst8> for Op

Source§

fn from(op: Xconst8) -> Self

Converts to this type from the input type.
Source§

impl From<Xeq32> for Op

Source§

fn from(op: Xeq32) -> Self

Converts to this type from the input type.
Source§

impl From<Xeq64> for Op

Source§

fn from(op: Xeq64) -> Self

Converts to this type from the input type.
Source§

impl From<Xmov> for Op

Source§

fn from(op: Xmov) -> Self

Converts to this type from the input type.
Source§

impl From<Xneq32> for Op

Source§

fn from(op: Xneq32) -> Self

Converts to this type from the input type.
Source§

impl From<Xneq64> for Op

Source§

fn from(op: Xneq64) -> Self

Converts to this type from the input type.
Source§

impl From<Xslt32> for Op

Source§

fn from(op: Xslt32) -> Self

Converts to this type from the input type.
Source§

impl From<Xslt64> for Op

Source§

fn from(op: Xslt64) -> Self

Converts to this type from the input type.
Source§

impl From<Xslteq32> for Op

Source§

fn from(op: Xslteq32) -> Self

Converts to this type from the input type.
Source§

impl From<Xslteq64> for Op

Source§

fn from(op: Xslteq64) -> Self

Converts to this type from the input type.
Source§

impl From<Xult32> for Op

Source§

fn from(op: Xult32) -> Self

Converts to this type from the input type.
Source§

impl From<Xult64> for Op

Source§

fn from(op: Xult64) -> Self

Converts to this type from the input type.
Source§

impl From<Xulteq32> for Op

Source§

fn from(op: Xulteq32) -> Self

Converts to this type from the input type.
Source§

impl From<Xulteq64> for Op

Source§

fn from(op: Xulteq64) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Op

Source§

fn eq(&self, other: &Op) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Op

Source§

impl Eq for Op

Source§

impl StructuralPartialEq for Op

Auto Trait Implementations§

§

impl Freeze for Op

§

impl RefUnwindSafe for Op

§

impl Send for Op

§

impl Sync for Op

§

impl Unpin for Op

§

impl UnwindSafe for Op

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> ToOwned for T
where T: Clone,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.