Skip to main content

CodeBuilder

Struct CodeBuilder 

Source
pub struct CodeBuilder { /* private fields */ }

Implementations§

Source§

impl CodeBuilder

Source

pub fn new() -> CodeBuilder

Source

pub fn with_capacity(instructions: usize) -> CodeBuilder

A builder with room for instructions before it grows.

Source

pub fn pc(&self) -> u32

The index the next instruction gets.

Source

pub fn raw(&mut self, insn: Insn) -> u32

Any instruction, without the format check.

Source

pub fn op(&mut self, op: Opcode) -> u32

Source

pub fn a(&mut self, op: Opcode, a: u8) -> u32

Source

pub fn ab(&mut self, op: Opcode, a: u8, b: u8) -> u32

Source

pub fn abc(&mut self, op: Opcode, a: u8, b: u8, c: u8) -> u32

Source

pub fn a_int(&mut self, op: Opcode, a: u8, value: i32) -> u32

Source

pub fn ab_int(&mut self, op: Opcode, a: u8, b: u8, value: i32) -> u32

Source

pub fn a_const(&mut self, op: Opcode, a: u8, index: u32) -> u32

Source

pub fn key(&mut self, op: Opcode, key: PropertyKey) -> u32

Source

pub fn a_key(&mut self, op: Opcode, a: u8, key: PropertyKey) -> u32

Source

pub fn ab_key(&mut self, op: Opcode, a: u8, b: u8, key: PropertyKey) -> u32

Source

pub fn a_capture(&mut self, op: Opcode, a: u8, capture: u32) -> u32

Source

pub fn a_count(&mut self, op: Opcode, a: u8, count: u32) -> u32

Source

pub fn ab_range(&mut self, op: Opcode, a: u8, first: u8, count: u32) -> u32

Source

pub fn a_child(&mut self, op: Opcode, a: u8, child: u32) -> u32

Source

pub fn call(&mut self, op: Opcode, dst: u8, callee: u8, argc: u8) -> u32

Source

pub fn jump(&mut self, op: Opcode, target: u32) -> u32

Source

pub fn a_jump(&mut self, op: Opcode, a: u8, target: u32) -> u32

Source

pub fn ab_jump(&mut self, op: Opcode, a: u8, b: u8, target: u32) -> u32

Source

pub fn a_short_jump( &mut self, op: Opcode, a: u8, value: i16, target: u32, ) -> u32

Source

pub fn a_wide(&mut self, op: Opcode, a: u8, register: u32) -> u32

Source

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).

Source

pub fn patch_target(&mut self, pc: u32, target: u32)

Sets the target of the jump at pc, emitted before its target was known.

Source

pub fn handler(&mut self, handler: Handler)

Adds a handler; nested handlers are added before the ones enclosing them.

Source

pub fn code(&self) -> &[Insn]

Source

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.

Source

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§

Source§

impl Default for CodeBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.