pub struct CodeBuilder { /* private fields */ }Implementations§
Source§impl CodeBuilder
impl CodeBuilder
pub fn new() -> CodeBuilder
Sourcepub fn with_capacity(instructions: usize) -> CodeBuilder
pub fn with_capacity(instructions: usize) -> CodeBuilder
A builder with room for instructions before it grows.
pub fn op(&mut self, op: Opcode) -> u32
pub fn a(&mut self, op: Opcode, a: u8) -> u32
pub fn ab(&mut self, op: Opcode, a: u8, b: u8) -> u32
pub fn abc(&mut self, op: Opcode, a: u8, b: u8, c: u8) -> u32
pub fn a_int(&mut self, op: Opcode, a: u8, value: i32) -> u32
pub fn ab_int(&mut self, op: Opcode, a: u8, b: u8, value: i32) -> u32
pub fn a_const(&mut self, op: Opcode, a: u8, index: u32) -> u32
pub fn key(&mut self, op: Opcode, key: PropertyKey) -> u32
pub fn a_key(&mut self, op: Opcode, a: u8, key: PropertyKey) -> u32
pub fn ab_key(&mut self, op: Opcode, a: u8, b: u8, key: PropertyKey) -> u32
pub fn a_capture(&mut self, op: Opcode, a: u8, capture: u32) -> u32
pub fn a_count(&mut self, op: Opcode, a: u8, count: u32) -> u32
pub fn ab_range(&mut self, op: Opcode, a: u8, first: u8, count: u32) -> u32
pub fn a_child(&mut self, op: Opcode, a: u8, child: u32) -> u32
pub fn call(&mut self, op: Opcode, dst: u8, callee: u8, argc: u8) -> u32
pub fn jump(&mut self, op: Opcode, target: u32) -> u32
pub fn a_jump(&mut self, op: Opcode, a: u8, target: u32) -> u32
pub fn ab_jump(&mut self, op: Opcode, a: u8, b: u8, target: u32) -> u32
pub fn a_short_jump( &mut self, op: Opcode, a: u8, value: i16, target: u32, ) -> u32
pub fn a_wide(&mut self, op: Opcode, a: u8, register: u32) -> u32
Sourcepub fn retarget(&mut self, pc: u32, a: u8)
pub fn retarget(&mut self, pc: u32, a: u8)
Changes the destination register of the instruction at pc (the
lowering’s retargeting of a temporary into a local).
Sourcepub fn patch_target(&mut self, pc: u32, target: u32)
pub fn patch_target(&mut self, pc: u32, target: u32)
Sets the target of the jump at pc, emitted before its target was
known.
Sourcepub fn handler(&mut self, handler: Handler)
pub fn handler(&mut self, handler: Handler)
Adds a handler; nested handlers are added before the ones enclosing them.
pub fn code(&self) -> &[Insn]
Sourcepub fn mark_back_edges(&mut self)
pub fn mark_back_edges(&mut self)
Turns every Jmp whose target is at or before it into JmpBack,
once the targets are final: the loop polls for interrupts on
back-edges only.
Sourcepub fn finish(self, layout: UnitLayout) -> CodeUnit
pub fn finish(self, layout: UnitLayout) -> CodeUnit
The unit, with the layout and counts the lowering decided, and its cache
sites numbered: the named-property sites first, in instruction order,
then the global and new sites.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodeBuilder
impl RefUnwindSafe for CodeBuilder
impl Send for CodeBuilder
impl Sync for CodeBuilder
impl Unpin for CodeBuilder
impl UnsafeUnpin for CodeBuilder
impl UnwindSafe for CodeBuilder
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