pub struct RcCodegen { /* private fields */ }Expand description
Generates reference counting operations as native IR instructions.
Implementations§
Source§impl RcCodegen
impl RcCodegen
Sourcepub fn emit_rc_inc(&mut self, obj_reg: Register) -> Vec<NativeInst>
pub fn emit_rc_inc(&mut self, obj_reg: Register) -> Vec<NativeInst>
Emit instructions to increment the reference count of an object.
if (obj != NULL && !lean_is_scalar(obj)) {
lean_inc_ref(obj);
}Sourcepub fn emit_rc_dec(&mut self, obj_reg: Register) -> Vec<NativeInst>
pub fn emit_rc_dec(&mut self, obj_reg: Register) -> Vec<NativeInst>
Emit instructions to decrement the reference count of an object. If the count reaches zero, the object is freed.
if (obj != NULL && !lean_is_scalar(obj)) {
lean_dec_ref(obj);
}Sourcepub fn emit_rc_is_unique(&mut self, obj_reg: Register) -> NativeInst
pub fn emit_rc_is_unique(&mut self, obj_reg: Register) -> NativeInst
Emit an instruction to check if an object has a unique reference (refcount == 1), enabling in-place mutation.
Sourcepub fn emit_conditional_reset(
&mut self,
obj_reg: Register,
_num_obj_fields: usize,
_scalar_size: usize,
) -> Vec<NativeInst>
pub fn emit_conditional_reset( &mut self, obj_reg: Register, _num_obj_fields: usize, _scalar_size: usize, ) -> Vec<NativeInst>
Emit a conditional reset: if the object is unique, reset it for reuse; otherwise, decrement and allocate fresh.
Sourcepub fn emit_rc_inc_n(
&mut self,
obj_reg: Register,
count: usize,
) -> Vec<NativeInst>
pub fn emit_rc_inc_n( &mut self, obj_reg: Register, count: usize, ) -> Vec<NativeInst>
Emit multi-reference increment (for when a variable is used N times).
Auto Trait Implementations§
impl Freeze for RcCodegen
impl RefUnwindSafe for RcCodegen
impl Send for RcCodegen
impl Sync for RcCodegen
impl Unpin for RcCodegen
impl UnsafeUnpin for RcCodegen
impl UnwindSafe for RcCodegen
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