pub enum Instruction {
Show 46 variants PushInt(VmInt), PushByte(u8), PushFloat(EqFloat), PushString(VmIndex), PushUpVar(VmIndex), Push(VmIndex), Call(VmIndex), TailCall(VmIndex), ConstructVariant { tag: VmIndex, args: VmIndex, }, ConstructPolyVariant { tag: VmIndex, args: VmIndex, }, NewVariant { tag: VmIndex, args: VmIndex, }, NewRecord { record: VmIndex, args: VmIndex, }, CloseData { index: VmIndex, }, ConstructRecord { record: VmIndex, args: VmIndex, }, ConstructArray(VmIndex), GetOffset(VmIndex), GetField(VmIndex), Split, TestTag(VmTag), TestPolyTag(VmIndex), Jump(VmIndex), CJump(VmIndex), Pop(VmIndex), Slide(VmIndex), MakeClosure { function_index: VmIndex, upvars: VmIndex, }, NewClosure { function_index: VmIndex, upvars: VmIndex, }, CloseClosure(VmIndex), AddInt, SubtractInt, MultiplyInt, DivideInt, IntLT, IntEQ, AddByte, SubtractByte, MultiplyByte, DivideByte, ByteLT, ByteEQ, AddFloat, SubtractFloat, MultiplyFloat, DivideFloat, FloatLT, FloatEQ, Return,
}
Expand description

Enum which represent the instructions executed by the virtual machine.

The binary arithmetic instructions pop two values of the stack and then push the result.

Variants§

§

PushInt(VmInt)

Push an integer to the stack

§

PushByte(u8)

Push a byte to the stack

§

PushFloat(EqFloat)

Push a float to the stack

§

PushString(VmIndex)

Push a string to the stack by loading the string at index in the currently executing function

§

PushUpVar(VmIndex)

Push a variable to the stack by loading the upvariable at index from the currently executing function

§

Push(VmIndex)

Push the value at index

§

Call(VmIndex)

Call a function by passing it args number of arguments. The function is at the index in the stack just before the arguments. After the call is all arguments are removed and the function is replaced by the result of the call.

§

TailCall(VmIndex)

Tailcalls a function, removing the current stack frame before calling it. See Call.

§

ConstructVariant

Fields

§tag: VmIndex

The tag of the data

§args: VmIndex

How many arguments that is taken from the stack to construct the data.

Constructs a data value tagged by tag by taking the top args values of the stack.

§

ConstructPolyVariant

Fields

§tag: VmIndex

The tag of the data

§args: VmIndex

How many arguments that is taken from the stack to construct the data.

§

NewVariant

Fields

§tag: VmIndex

The tag of the data

§args: VmIndex

How many arguments that is taken from the stack to construct the data.

§

NewRecord

Fields

§record: VmIndex

Index to the specification describing which fields this record contains

§args: VmIndex

How large the record is

§

CloseData

Fields

§index: VmIndex

Where the record is located

§

ConstructRecord

Fields

§record: VmIndex

Index to the specification describing which fields this record contains

§args: VmIndex

How many arguments that is taken from the stack to construct the data.

§

ConstructArray(VmIndex)

Constructs an array containing args values.

§

GetOffset(VmIndex)

Retrieves the field at offset of an object at the top of the stack. The result of the field access replaces the object on the stack.

§

GetField(VmIndex)

Retrieves the field of a polymorphic record by retrieving the string constant at index and using that to retrieve lookup the field. The result of the field access replaces the object on the stack.

§

Split

Splits a object, pushing all contained values to the stack.

§

TestTag(VmTag)

Tests if the value at the top of the stack is tagged with tag. Pushes True if the tag matches, otherwise False

§

TestPolyTag(VmIndex)

§

Jump(VmIndex)

Jumps to the instruction at index in the currently executing function.

§

CJump(VmIndex)

Jumps to the instruction at index in the currently executing function if True is at the top of the stack and pops that value.

§

Pop(VmIndex)

Pops the top n values from the stack.

§

Slide(VmIndex)

Pops the top value from the stack, then pops n more values, finally the first value is pushed back to the stack.

§

MakeClosure

Fields

§function_index: VmIndex

The index in the currently executing function which the function data is located at

§upvars: VmIndex

How many upvariables the closure contains

Creates a closure with the function at function_index of the currently executing function and upvars upvariables popped from the top of the stack.

§

NewClosure

Fields

§function_index: VmIndex

The index in the currently executing function which the function data is located at

§upvars: VmIndex

How many upvariables the closure contains

Creates a closure with the function at function_index of the currently executing function. The closure has room for upvars upvariables but these are not filled until the matching call to ClosureClosure is executed.

§

CloseClosure(VmIndex)

Fills the previously allocated closure with n upvariables.

§

AddInt

§

SubtractInt

§

MultiplyInt

§

DivideInt

§

IntLT

§

IntEQ

§

AddByte

§

SubtractByte

§

MultiplyByte

§

DivideByte

§

ByteLT

§

ByteEQ

§

AddFloat

§

SubtractFloat

§

MultiplyFloat

§

DivideFloat

§

FloatLT

§

FloatEQ

§

Return

Implementations§

source§

impl Instruction

source

pub fn adjust(&self) -> i32

Returns by how much the stack is adjusted when executing the instruction self.

Trait Implementations§

source§

impl Clone for Instruction

source§

fn clone(&self) -> Instruction

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 Instruction

source§

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

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

impl<'de> Deserialize<'de> for Instruction

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Hash for Instruction

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 PartialEq for Instruction

source§

fn eq(&self, other: &Instruction) -> 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 Serialize for Instruction

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for Instruction

source§

impl Eq for Instruction

source§

impl StructuralEq for Instruction

source§

impl StructuralPartialEq for Instruction

Auto Trait Implementations§

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<Id> AsId<Id> for Id
where Id: ?Sized,

source§

fn as_id(&self) -> &Id

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
§

impl<T> CallHasher for T
where T: Hash + ?Sized,

§

fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

§

fn subset( self ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastArc for T
where T: Downcast + Send + Sync,

source§

fn into_arc_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<Q, K> Equivalent<K> for Q
where 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 Q
where 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<D, T> FromPtr<D> for T

source§

unsafe fn make_ptr(_: D, ptr: *mut ()) -> *mut T

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.

§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

§

fn lift_into(self) -> U

Performs the indexed conversion.
§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

impl<T> ToOwned for T
where 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, U> TryFrom<U> for T
where 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 T
where 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.
§

impl<T> Any for T
where T: Any,

source§

impl<T> Captures<'_> for T

§

impl<T> CloneAny for T
where T: Any + Clone,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,