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 Collect for OpCodewhere
Self: 'static,
impl Collect for OpCodewhere
Self: 'static,
Source§fn needs_trace() -> bool
fn needs_trace() -> bool
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)
fn trace(&self, _cc: &Collection)
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 Ord for OpCode
impl Ord for OpCode
Source§impl PartialOrd for OpCode
impl PartialOrd for OpCode
impl Copy for OpCode
impl Eq for OpCode
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.