pub struct Fn<'a> { /* private fields */ }Expand description
Emit instructions for one bytecode function.
Implementations§
Source§impl<'a> Fn<'a>
impl<'a> Fn<'a>
Sourcepub fn reg(&mut self, index: u8) -> Reg
pub fn reg(&mut self, index: u8) -> Reg
Bind to an explicit register index without growing the declared frame.
Sourcepub fn window(&mut self, count: u8) -> RegWindow
pub fn window(&mut self, count: u8) -> RegWindow
Allocate count contiguous locals; useful before Self::native_n.
Sourcepub fn load_i32(&mut self, n: i32) -> Reg
pub fn load_i32(&mut self, n: i32) -> Reg
Load a small immediate into a new local.
Examples found in repository?
More examples
pub fn sub(&mut self, lhs: Reg, rhs: Reg) -> Reg
pub fn mul(&mut self, lhs: Reg, rhs: Reg) -> Reg
pub fn div(&mut self, lhs: Reg, rhs: Reg) -> Reg
pub fn modulo(&mut self, lhs: Reg, rhs: Reg) -> Reg
pub fn neg(&mut self, src: Reg) -> Reg
pub fn eq(&mut self, lhs: Reg, rhs: Reg) -> Reg
pub fn eq_imm(&mut self, lhs: Reg, imm: i32) -> Reg
pub fn lt(&mut self, lhs: Reg, rhs: Reg) -> Reg
pub fn le(&mut self, lhs: Reg, rhs: Reg) -> Reg
Sourcepub fn while_lt<F>(&mut self, counter: Reg, limit: Reg, body: F)
pub fn while_lt<F>(&mut self, counter: Reg, limit: Reg, body: F)
While counter < limit (interpreter Branch skips on falsy).
pub fn label(&mut self) -> Label
pub fn bind(&mut self, label: Label)
pub fn jump(&mut self, label: Label)
Sourcepub fn branch_if_falsy(&mut self, cond: Reg, target: Label)
pub fn branch_if_falsy(&mut self, cond: Reg, target: Label)
Branch when cond is falsy (0).
Sourcepub fn return_(&mut self, value: Reg)
pub fn return_(&mut self, value: Reg)
Examples found in repository?
More examples
pub fn call(&mut self, function: FuncId, argc: u8) -> Reg
pub fn halt(&mut self)
pub fn yield_(&mut self)
pub fn sleep(&mut self, millis: Reg)
pub fn exit(&mut self, reg: Reg)
pub fn spawn(&mut self, function: FuncId, argc: u8) -> Reg
Sourcepub fn spawn_at(&mut self, dst: Reg, function: FuncId, argc: u8)
pub fn spawn_at(&mut self, dst: Reg, function: FuncId, argc: u8)
Spawn into an explicit destination register (e.g. reg(255)).
pub fn send(&mut self, target_cap: Reg, msg: Reg)
pub fn receive(&mut self) -> Reg
pub fn receive_timeout(&mut self, millis: Reg) -> Reg
pub fn receive_match(&mut self, tag: Reg) -> Reg
pub fn receive_match_imm(&mut self, tag: u16) -> Reg
Sourcepub fn ask(&mut self, target_cap: Reg, msg: Reg) -> Reg
pub fn ask(&mut self, target_cap: Reg, msg: Reg) -> Reg
RPC hop: deliver msg to target_cap, wait for correlated reply.
pub fn trap(&mut self, code: i32)
Sourcepub fn native1_from(&mut self, src: Reg, native: u32) -> Reg
pub fn native1_from(&mut self, src: Reg, native: u32) -> Reg
Copy src, call a one-arg native, return the result in a new local.
The source register is preserved (CallNative clobbers its argument slot).
Sourcepub fn native1_on(&mut self, src: Reg, native: u32)
pub fn native1_on(&mut self, src: Reg, native: u32)
Side-effect native on a copy of src (e.g. print).
Sourcepub fn native_n(&mut self, base: Reg, native: u32, argc: u8)
pub fn native_n(&mut self, base: Reg, native: u32, argc: u8)
CallNative with argc args already at base..base+argc.
Sourcepub fn call_native(&mut self, base: Reg, native: u32, argc: u8)
pub fn call_native(&mut self, base: Reg, native: u32, argc: u8)
Call a native with argc args already in base..base+argc.
Sourcepub fn call_native0(&mut self, native: u32) -> Reg
pub fn call_native0(&mut self, native: u32) -> Reg
Call a zero-arg native; returns the result register.
Sourcepub fn make_msg(
&mut self,
native_index: u32,
sender: Reg,
request_id: Reg,
tag: i32,
payload: Reg,
) -> Reg
pub fn make_msg( &mut self, native_index: u32, sender: Reg, request_id: Reg, tag: i32, payload: Reg, ) -> Reg
Build a Value::Message via make_msg at native_index.
Index 2 in crate::std_native_map. Args are packed into a
contiguous four-register window; returns the message register.