pub enum OpCode {
Show 49 variants Pop, Dup, DupTwo, RotTwo, RotThree, LoadLocal(usize), LoadGlobal(usize), LoadUpvalue(usize), LoadConst(usize), StoreLocal(usize), StoreGlobal(usize), StoreUpvalue(usize), Import(usize), ImportFrom(usize), ImportGlob, BuildTable(usize), BuildList(usize), GetAttr, GetItem, GetMeta, SetAttr, SetItem, SetMeta, Neg, Not, Add, Sub, Mul, Div, Mod, Eq, Ne, Gt, Ge, Lt, Le, Is, For(JumpTarget), Jump(JumpTarget), JumpIfNull(JumpTarget), JumpPopIfFalse(JumpTarget), JumpIfTureOrPop(JumpTarget), JumpIfFalseOrPop(JumpTarget), Call(usize), TryCall(usize), Return, Throw, ReturnCall(usize), JumpTarget(JumpTarget),
}
Expand description

The operation code.

Variants§

§

Pop

Removes the top-of-stack (TOS) item.

§

Dup

Duplicates the reference on top of the stack.

§

DupTwo

Duplicates the two references on top of the stack, leaving them in the same order.

§

RotTwo

Swaps the two top-most stack items.

§

RotThree

Lifts second and third stack item one position up, moves top down to position three.

§

LoadLocal(usize)

Pushes the value associated with local_names[namei] onto the stack.

§

LoadGlobal(usize)

Pushes the value associated with global_names[namei] onto the stack.

§

LoadUpvalue(usize)

Pushes the value associated with upvalue_names[namei] onto the stack.

§

LoadConst(usize)

Pushes consts[consti] onto the stack.

§

StoreLocal(usize)

Stores TOS into the local_names[namei].

§

StoreGlobal(usize)

Stores TOS into the global_names[namei].

§

StoreUpvalue(usize)

Stores TOS into the upvalue_names[namei].

§

Import(usize)

Imports the module consts[consti] and pushed it onto the stack.

§

ImportFrom(usize)

Loads the attribute consts[consti] the module found in TOS and pushed it onto the stack.

§

ImportGlob

LoLoads all symbols from the module TOS to the global namespace.

§

BuildTable(usize)

Pushes a new table onto the stack. Pops 2 * count items to build table.

§

BuildList(usize)

Pushes a new list onto the stack. Pops count items to build list.

§

GetAttr

Implements TOS = TOS1::TOS.

§

GetItem

Implements TOS = TOS1[TOS].

§

GetMeta

Implements TOS = TOS[#].

§

SetAttr

Implements TOS1::TOS = TOS2.

§

SetItem

Implements TOS1[TOS] = TOS2.

§

SetMeta

Implements TOS[#] = TOS1.

§

Neg

Implements TOS = -TOS.

§

Not

Implements TOS = not TOS.

§

Add

Implements TOS = TOS1 + TOS.

§

Sub

Implements TOS = TOS1 - TOS.

§

Mul

Implements TOS = TOS1 * TOS.

§

Div

Implements TOS = TOS1 / TOS.

§

Mod

Implements TOS = TOS1 % TOS.

§

Eq

Implements TOS = TOS1 == TOS.

§

Ne

Implements TOS = TOS1 != TOS.

§

Gt

Implements TOS = TOS1 > TOS.

§

Ge

Implements TOS = TOS1 >= TOS.

§

Lt

Implements TOS = TOS1 < TOS.

§

Le

Implements TOS = TOS1 <= TOS.

§

Is

Implements TOS = TOS1 is TOS.

§

For(JumpTarget)

If TOS is iterable or callable, call TOS and get the return value, if the return value if null, jump to target, else push the return value onto the stack. Used in for statement.

§

Jump(JumpTarget)

Sets the bytecode counter to target.

§

JumpIfNull(JumpTarget)

If TOS is null, sets the bytecode counter to target.

§

JumpPopIfFalse(JumpTarget)

If TOS is false, sets the bytecode counter to target. TOS is popped.

§

JumpIfTureOrPop(JumpTarget)

If TOS is true, sets the bytecode counter to target and leaves TOS on the stack. Otherwise, TOS is popped.

§

JumpIfFalseOrPop(JumpTarget)

If TOS is false, sets the bytecode counter to target and leaves TOS on the stack. Otherwise, TOS is popped.

§

Call(usize)

Pops numbers of item for function arguments, then pop an callable value and call it.

§

TryCall(usize)

Call with a shortcut for propagating errors.

§

Return

Returns with TOS to the caller of the function.

§

Throw

Returns with TOS as a error.

§

ReturnCall(usize)

Same as “Call(usize); Return;”, this is for tail call optimization.

§

JumpTarget(JumpTarget)

A jump target, only used during code generation.

Trait Implementations§

source§

impl Clone for OpCode

source§

fn clone(&self) -> OpCode

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 OpCode

source§

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

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

impl Display for OpCode

source§

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

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

impl Ord for OpCode

source§

fn cmp(&self, other: &OpCode) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<OpCode> for OpCode

source§

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

source§

fn partial_cmp(&self, other: &OpCode) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TryFrom<BinOp> for OpCode

§

type Error = Error

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

fn try_from(value: BinOp) -> Result<Self>

Performs the conversion.
source§

impl Eq for OpCode

source§

impl StructuralEq for OpCode

source§

impl StructuralPartialEq for OpCode

Auto Trait Implementations§

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

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

source§

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

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

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.