pub trait InstructionExt {
Show 16 methods
// Required methods
fn opcode(&self) -> OpCode;
fn arg_a(&self) -> i32;
fn arg_b(&self) -> i32;
fn arg_c(&self) -> i32;
fn arg_k(&self) -> i32;
fn arg_ax(&self) -> i32;
fn arg_bx(&self) -> i32;
fn arg_s_b(&self) -> i32;
fn arg_s_c(&self) -> i32;
fn arg_s_j(&self) -> i32;
fn arg_s_bx(&self) -> i32;
fn test_k(&self) -> bool;
fn test_a_mode(&self) -> bool;
fn is_mm_mode(&self) -> bool;
fn is_vararg_prep(&self) -> bool;
fn is_in_top(&self) -> bool;
}Expand description
TODO(phase-b): Instruction accessor extension trait. The real per-mode
decode helpers live in lua-types::opcode once translated. Stubbed locally
so call sites resolve; bodies are inferred from lopcodes.h macro shapes.
Required Methods§
fn opcode(&self) -> OpCode
fn arg_a(&self) -> i32
fn arg_b(&self) -> i32
fn arg_c(&self) -> i32
fn arg_k(&self) -> i32
fn arg_ax(&self) -> i32
fn arg_bx(&self) -> i32
fn arg_s_b(&self) -> i32
fn arg_s_c(&self) -> i32
fn arg_s_j(&self) -> i32
fn arg_s_bx(&self) -> i32
fn test_k(&self) -> bool
fn test_a_mode(&self) -> bool
fn is_mm_mode(&self) -> bool
fn is_vararg_prep(&self) -> bool
fn is_in_top(&self) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl InstructionExt for Instruction
impl InstructionExt for Instruction
Source§fn opcode(&self) -> OpCode
fn opcode(&self) -> OpCode
C: GET_OPCODE(i) = (OpCode)((i) >> POS_OP & MASK1(SIZE_OP,0)).
The 83-arm match looks expensive, but because OpCode is
#[repr(u8)] with explicit discriminants 0..=82 matching each match
arm’s integer key exactly, LLVM compiles this to a single bounds
check + identity cast — no jump table, no memory indirection. The
previous array-lookup form forced an extra OPCODE_TABLE byte load
per dispatch tick that LLVM could not see through.