Skip to main content

Opcode

Enum Opcode 

Source
#[repr(u8)]
pub enum Opcode {
Show 72 variants Push = 0, Pop = 1, Dup = 2, LoadLocal = 3, StoreLocal = 4, LoadGlobal = 5, StoreGlobal = 6, LoadUpvalue = 7, StoreUpvalue = 8, Add = 9, Sub = 10, Mul = 11, Div = 12, Mod = 13, Pow = 14, Neg = 15, BitAnd = 16, BitOr = 17, BitXor = 18, BitNot = 19, Shl = 20, Shr = 21, Eq = 22, Ne = 23, Lt = 24, Le = 25, Gt = 26, Ge = 27, AddImm = 28, SubImm = 29, MulImm = 30, EqImm = 31, NeImm = 32, LtImm = 33, LeImm = 34, GtImm = 35, GeImm = 36, And = 37, Or = 38, Not = 39, Jump = 40, JumpIfFalse = 41, JumpIfTrue = 42, Call = 43, TailCall = 44, Return = 45, GetProperty = 46, SetProperty = 47, Invoke = 48, BuildArray = 49, BuildMap = 50, IndexGet = 51, IndexSet = 52, CreateClass = 53, CreateInstance = 54, GetMethod = 55, MatchPattern = 56, MakeClosure = 57, Throw = 58, TryBegin = 59, TryEnd = 60, WrapOk = 61, WrapErr = 62, WrapSome = 63, UnwrapOk = 64, UnwrapErr = 65, UnwrapSome = 66, Try = 67, Nop = 68, Halt = 69, CallDirect = 70, Argc = 71,
}
Expand description

Opcode is Copy and serialized as a single byte in the binary format. Keep variants in a stable order; append-only.

Variants§

§

Push = 0

§

Pop = 1

§

Dup = 2

§

LoadLocal = 3

§

StoreLocal = 4

§

LoadGlobal = 5

§

StoreGlobal = 6

§

LoadUpvalue = 7

§

StoreUpvalue = 8

§

Add = 9

§

Sub = 10

§

Mul = 11

§

Div = 12

§

Mod = 13

§

Pow = 14

§

Neg = 15

§

BitAnd = 16

§

BitOr = 17

§

BitXor = 18

§

BitNot = 19

§

Shl = 20

§

Shr = 21

§

Eq = 22

§

Ne = 23

§

Lt = 24

§

Le = 25

§

Gt = 26

§

Ge = 27

§

AddImm = 28

§

SubImm = 29

§

MulImm = 30

§

EqImm = 31

§

NeImm = 32

§

LtImm = 33

§

LeImm = 34

§

GtImm = 35

§

GeImm = 36

§

And = 37

§

Or = 38

§

Not = 39

§

Jump = 40

§

JumpIfFalse = 41

§

JumpIfTrue = 42

§

Call = 43

§

TailCall = 44

§

Return = 45

§

GetProperty = 46

§

SetProperty = 47

§

Invoke = 48

§

BuildArray = 49

§

BuildMap = 50

§

IndexGet = 51

§

IndexSet = 52

§

CreateClass = 53

§

CreateInstance = 54

§

GetMethod = 55

§

MatchPattern = 56

§

MakeClosure = 57

§

Throw = 58

§

TryBegin = 59

§

TryEnd = 60

§

WrapOk = 61

§

WrapErr = 62

§

WrapSome = 63

§

UnwrapOk = 64

§

UnwrapErr = 65

§

UnwrapSome = 66

§

Try = 67

? — Ok/Some → inner; Err/Null early-return from current frame.

§

Nop = 68

§

Halt = 69

§

CallDirect = 70

Direct call to a known chunk. operand = (chunk_index << 16) | arity. Stack: [func_slot_placeholder, args…]

§

Argc = 71

Push the number of arguments actually passed to the current frame.

Implementations§

Source§

impl Opcode

Source

pub fn as_u8(self) -> u8

Stable discriminant used by the binary bytecode format.

Source

pub fn from_u8(v: u8) -> Option<Self>

Trait Implementations§

Source§

impl Clone for Opcode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Opcode

Source§

impl Debug for Opcode

Source§

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

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

impl<'de> Deserialize<'de> for Opcode

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 Eq for Opcode

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

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Opcode

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 StructuralPartialEq for Opcode

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<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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.