#[repr(transparent)]pub struct Instruction(pub u32);Expand description
A single Lua bytecode instruction (unsigned 32-bit word).
C: typedef unsigned int Instruction; (see llimits.h)
Tuple Fields§
§0: u32Implementations§
Source§impl Instruction
impl Instruction
Sourcepub const fn get_arg(self, pos: u32, size: u32) -> u32
pub const fn get_arg(self, pos: u32, size: u32) -> u32
Extract a bit-field of size bits at position pos.
C: getarg(i, pos, size) — cast_int(((i)>>(pos)) & MASK1(size,0))
Sourcepub fn set_arg(&mut self, v: u32, pos: u32, size: u32)
pub fn set_arg(&mut self, v: u32, pos: u32, size: u32)
Set a bit-field of size bits at position pos to v.
C: setarg(i, v, pos, size)
Sourcepub fn opcode(self) -> Option<OpCode>
pub fn opcode(self) -> Option<OpCode>
Extract the opcode.
C: GET_OPCODE(i) — cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0))
Sourcepub fn set_opcode(&mut self, op: OpCode)
pub fn set_opcode(&mut self, op: OpCode)
Replace the opcode field.
C: SET_OPCODE(i, o)
Sourcepub const fn arg_b(self) -> u32
pub const fn arg_b(self) -> u32
C: GETARG_B(i) — debug-asserts iABC mode in C; here we trust the caller.
Sourcepub fn set_arg_bx(&mut self, v: u32)
pub fn set_arg_bx(&mut self, v: u32)
C: SETARG_Bx(i, v)
Sourcepub fn set_arg_s_bx(&mut self, b: i32)
pub fn set_arg_s_bx(&mut self, b: i32)
C: SETARG_sBx(i, b) — stores b + OFFSET_S_BX in the Bx field.
Sourcepub fn set_arg_ax(&mut self, v: u32)
pub fn set_arg_ax(&mut self, v: u32)
C: SETARG_Ax(i, v)
Sourcepub fn set_arg_s_j(&mut self, j: i32)
pub fn set_arg_s_j(&mut self, j: i32)
C: SETARG_sJ(i, j) — stores j + OFFSET_S_J in the sJ field.
Sourcepub fn abck(op: OpCode, a: u32, b: u32, c: u32, k: u32) -> Self
pub fn abck(op: OpCode, a: u32, b: u32, c: u32, k: u32) -> Self
Build an iABC instruction.
C: CREATE_ABCk(o, a, b, c, k)
Sourcepub fn abx(op: OpCode, a: u32, bc: u32) -> Self
pub fn abx(op: OpCode, a: u32, bc: u32) -> Self
Build an iABx instruction.
C: CREATE_ABx(o, a, bc)
Sourcepub fn is_out_top(self) -> bool
pub fn is_out_top(self) -> bool
True if this instruction sets L->top for the next instruction.
C: isOT(i) —
(testOTMode(GET_OPCODE(i)) && GETARG_C(i) == 0) || GET_OPCODE(i) == OP_TAILCALL
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Instruction
impl Debug for Instruction
Source§impl Default for Instruction
impl Default for Instruction
Source§fn default() -> Instruction
fn default() -> Instruction
Source§impl PartialEq for Instruction
impl PartialEq for Instruction
Source§fn eq(&self, other: &Instruction) -> bool
fn eq(&self, other: &Instruction) -> bool
self and other values to be equal, and is used by ==.