pub struct ClosureCodegen { /* private fields */ }Expand description
Generates code for closure creation, application, and partial application.
Implementations§
Source§impl ClosureCodegen
impl ClosureCodegen
pub fn new() -> Self
Sourcepub fn emit_closure_create(
&mut self,
fn_name: &str,
arity: usize,
env_regs: &[Register],
) -> Vec<NativeInst>
pub fn emit_closure_create( &mut self, fn_name: &str, arity: usize, env_regs: &[Register], ) -> Vec<NativeInst>
Emit instructions to create a closure.
Sourcepub fn emit_closure_apply(
&mut self,
closure_reg: Register,
arg_regs: &[Register],
) -> Vec<NativeInst>
pub fn emit_closure_apply( &mut self, closure_reg: Register, arg_regs: &[Register], ) -> Vec<NativeInst>
Emit instructions to apply a closure to arguments.
Sourcepub fn emit_partial_apply(
&mut self,
closure_reg: Register,
arg_regs: &[Register],
) -> Vec<NativeInst>
pub fn emit_partial_apply( &mut self, closure_reg: Register, arg_regs: &[Register], ) -> Vec<NativeInst>
Emit instructions for partial application.
When a closure with arity N is applied to M < N arguments, create a new closure with arity N-M that captures the original closure’s environment plus the M new arguments.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClosureCodegen
impl RefUnwindSafe for ClosureCodegen
impl Send for ClosureCodegen
impl Sync for ClosureCodegen
impl Unpin for ClosureCodegen
impl UnsafeUnpin for ClosureCodegen
impl UnwindSafe for ClosureCodegen
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