Enum gluon_vm::types::Instruction[][src]

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

Tuple Fields of PushInt

0: VmInt
PushByte(u8)

Push a byte to the stack

Tuple Fields of PushByte

0: u8
PushFloat(EqFloat)

Push a float to the stack

Tuple Fields of PushFloat

0: EqFloat
PushString(VmIndex)

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

Tuple Fields of PushString

0: VmIndex
PushUpVar(VmIndex)

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

Tuple Fields of PushUpVar

0: VmIndex
Push(VmIndex)

Push the value at index

Tuple Fields of Push

0: VmIndex
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.

Tuple Fields of Call

0: VmIndex
TailCall(VmIndex)

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

Tuple Fields of TailCall

0: VmIndex
ConstructVariant

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

Fields of ConstructVariant

tag: VmIndex

The tag of the data

args: VmIndex

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

ConstructPolyVariant

Fields of ConstructPolyVariant

tag: VmIndex

The tag of the data

args: VmIndex

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

NewVariant

Fields of NewVariant

tag: VmIndex

The tag of the data

args: VmIndex

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

NewRecord

Fields of NewRecord

record: VmIndex

Index to the specification describing which fields this record contains

args: VmIndex

How large the record is

CloseData

Fields of CloseData

index: VmIndex

Where the record is located

ConstructRecord

Fields of ConstructRecord

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.

Tuple Fields of ConstructArray

0: VmIndex
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.

Tuple Fields of GetOffset

0: VmIndex
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.

Tuple Fields of GetField

0: VmIndex
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

Tuple Fields of TestTag

0: VmTag
TestPolyTag(VmIndex)

Tuple Fields of TestPolyTag

0: VmIndex
Jump(VmIndex)

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

Tuple Fields of Jump

0: VmIndex
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.

Tuple Fields of CJump

0: VmIndex
Pop(VmIndex)

Pops the top n values from the stack.

Tuple Fields of Pop

0: VmIndex
Slide(VmIndex)

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

Tuple Fields of Slide

0: VmIndex
MakeClosure

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

Fields of MakeClosure

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

NewClosure

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.

Fields of NewClosure

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

CloseClosure(VmIndex)

Fills the previously allocated closure with n upvariables.

Tuple Fields of CloseClosure

0: VmIndex
AddInt
SubtractInt
MultiplyInt
DivideInt
IntLT
IntEQ
AddByte
SubtractByte
MultiplyByte
DivideByte
ByteLT
ByteEQ
AddFloat
SubtractFloat
MultiplyFloat
DivideFloat
FloatLT
FloatEQ
Return

Implementations

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

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

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. Read more

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

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

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

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

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

Performs the conversion.

Performs the conversion.

Performs the indexed conversion.

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.