pub struct Instruction(pub u32);
Expand description
AArch64 instruction representation (32-bit fixed-width instructions)
Tuple Fields§
§0: u32
Implementations§
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Instruction
impl Debug for Instruction
Source§impl Display for Instruction
impl Display for Instruction
Source§impl Instruction for Instruction
impl Instruction for Instruction
Source§impl InstructionBuilder<Instruction> for Aarch64InstructionBuilder
impl InstructionBuilder<Instruction> for Aarch64InstructionBuilder
Source§unsafe fn function<F>(&self) -> Result<CallableJitFunction<F>, JitError>
unsafe fn function<F>(&self) -> Result<CallableJitFunction<F>, JitError>
Create a JIT-compiled function from the assembled instructions (std-only)
This method converts the assembled instructions into executable machine code
that can be called directly as a function. The generic type parameter F
specifies the function signature.
§Safety
This function is unsafe because:
- It allocates executable memory
- It assumes the assembled code follows the correct ABI
- The caller must ensure the function signature matches the actual code
§Examples
use jit_assembler::aarch64::{reg, Aarch64InstructionBuilder};
use jit_assembler::common::InstructionBuilder;
let add_func = unsafe {
Aarch64InstructionBuilder::new()
.add(reg::X0, reg::X0, reg::X1) // Add first two arguments
.ret()
.function::<fn(u64, u64) -> u64>()
}.expect("Failed to create JIT function");
// Call the JIT function directly (only works on AArch64 hosts)
// let result = add_func.call(10, 20); // Returns 30
Source§fn instructions(&self) -> InstructionCollection<Instruction>
fn instructions(&self) -> InstructionCollection<Instruction>
Get the generated instructions
Source§fn push(&mut self, instr: Instruction)
fn push(&mut self, instr: Instruction)
Add an instruction to the builder
Source§unsafe fn raw_function(&self) -> Result<RawCallableJitFunction, JitError>
unsafe fn raw_function(&self) -> Result<RawCallableJitFunction, JitError>
Create a raw JIT-compiled function for manual type conversion (std-only) Read more
Source§impl PartialEq for Instruction
impl PartialEq for Instruction
impl Copy for Instruction
impl Eq for Instruction
impl StructuralPartialEq for Instruction
Auto Trait Implementations§
impl Freeze for Instruction
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
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
Mutably borrows from an owned value. Read more