OpCode

Enum OpCode 

Source
pub enum OpCode {
Show 47 variants Pop, Copy(usize), Swap(usize), 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, Iter, Jump(JumpTarget), JumpIfNull(JumpTarget), JumpPopIfFalse(JumpTarget), JumpIfTrueOrPop(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.

§

Copy(usize)

Push the i-th item to the top of the stack.

§

Swap(usize)

Swap TOS with the item at position i.

§

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

Loads 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.

§

Iter

Get the iter of TOS and pushed it onto the stack.

§

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.

§

JumpIfTrueOrPop(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 duplicate 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 Collect for OpCode
where Self: 'static,

Source§

fn needs_trace() -> bool

As an optimization, if this type can never hold a Gc pointer and trace is unnecessary to call, you may implement this method and return false. The default implementation returns true, signaling that Collect::trace must be called.
Source§

fn trace(&self, _cc: &Collection)

Must call Collect::trace on all held Gc pointers. If this type holds inner types that implement Collect, a valid implementation would simply call Collect::trace on all the held values to ensure this.
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 Hash for OpCode

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 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) -> Self
where Self: Sized,

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

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

impl PartialEq for OpCode

Source§

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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TryFrom<BinOp> for OpCode

Source§

type Error = SyntaxError

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

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

Performs the conversion.
Source§

impl Copy for OpCode

Source§

impl Eq for OpCode

Source§

impl StructuralPartialEq for OpCode

Auto Trait Implementations§

§

impl Freeze for OpCode

§

impl RefUnwindSafe for OpCode

§

impl Send for OpCode

§

impl Sync for OpCode

§

impl Unpin for OpCode

§

impl UnwindSafe for OpCode

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, dest: *mut u8)

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

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

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

Source§

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

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

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

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.