pub struct CodeBuilder { /* private fields */ }Expand description
Low-level builder for paged IR code.
Manages allocation of pages and writing 16-bit words to the current position.
Implementations§
Source§impl CodeBuilder
impl CodeBuilder
pub fn new(options: CompilerOptions) -> Result<CodeBuilder, AllocError>
Sourcepub fn pages(&self) -> &[Box<TextPage>]
pub fn pages(&self) -> &[Box<TextPage>]
Borrow the accumulated text pages for execution.
The interpreter reads code directly from this slice, so no copy of the pages is needed to run the compiled module.
Sourcepub fn offset(&self) -> usize
pub fn offset(&self) -> usize
The write offset within the final (partially-filled) page, i.e. the number of 16-bit words used on the last page.
Sourcepub fn pc(&self) -> JumpTarget
pub fn pc(&self) -> JumpTarget
Get the current program counter (address of the next word to be written)
Auto Trait Implementations§
impl !Send for CodeBuilder
impl !Sync for CodeBuilder
impl Freeze for CodeBuilder
impl RefUnwindSafe 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