pub struct ArrayCodegen { /* private fields */ }Expand description
Generates code for array operations: allocation, get, set, resize.
Implementations§
Source§impl ArrayCodegen
impl ArrayCodegen
Sourcepub fn new(strategy: AllocStrategy) -> Self
pub fn new(strategy: AllocStrategy) -> Self
Create a new array codegen.
Sourcepub fn emit_alloc_array(&mut self, capacity: usize) -> Vec<NativeInst>
pub fn emit_alloc_array(&mut self, capacity: usize) -> Vec<NativeInst>
Emit instructions to allocate an array with the given initial capacity.
Sourcepub fn emit_array_get(
&mut self,
arr_reg: Register,
idx_reg: Register,
) -> Vec<NativeInst>
pub fn emit_array_get( &mut self, arr_reg: Register, idx_reg: Register, ) -> Vec<NativeInst>
Emit an array get instruction.
Sourcepub fn emit_array_set(
&mut self,
arr_reg: Register,
idx_reg: Register,
val_reg: Register,
) -> Vec<NativeInst>
pub fn emit_array_set( &mut self, arr_reg: Register, idx_reg: Register, val_reg: Register, ) -> Vec<NativeInst>
Emit an array set instruction (mutating).
Sourcepub fn emit_array_push(
&mut self,
arr_reg: Register,
val_reg: Register,
) -> Vec<NativeInst>
pub fn emit_array_push( &mut self, arr_reg: Register, val_reg: Register, ) -> Vec<NativeInst>
Emit an array push (append element).
Sourcepub fn emit_array_size(&mut self, arr_reg: Register) -> Vec<NativeInst>
pub fn emit_array_size(&mut self, arr_reg: Register) -> Vec<NativeInst>
Emit an array size query.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ArrayCodegen
impl RefUnwindSafe for ArrayCodegen
impl Send for ArrayCodegen
impl Sync for ArrayCodegen
impl Unpin for ArrayCodegen
impl UnsafeUnpin for ArrayCodegen
impl UnwindSafe for ArrayCodegen
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