pub struct EmitContext {
pub env: ScopedEnv,
pub lambda_counter: u32,
pub prefix: String,
/* private fields */
}Expand description
Emission context — bundles state during IR generation for one function.
Fields§
§env: ScopedEnv§lambda_counter: u32§prefix: StringImplementations§
Source§impl EmitContext
impl EmitContext
Sourcepub fn emit_node(
&mut self,
sess: &mut EmitSession<'_>,
builder: &mut FunctionBuilder<'_>,
root_idx: usize,
tail: TailCtx,
) -> Result<SsaVal, EmitError>
pub fn emit_node( &mut self, sess: &mut EmitSession<'_>, builder: &mut FunctionBuilder<'_>, root_idx: usize, tail: TailCtx, ) -> Result<SsaVal, EmitError>
Trampoline-based emit_node: converts recursive Let-chain evaluation to an explicit work stack. This prevents Rust stack overflow during JIT compilation of deeply nested GHC Core ASTs.
Recursive calls that remain (bounded, safe):
- emit_lam/emit_thunk: create new EmitContext, bounded by lambda nesting
- emit_case/emit_join: called from hylomorphism collapse, bounded by case nesting
- Trivial Con field eval: constant stack depth (Var/Lit)
Source§impl EmitContext
impl EmitContext
pub fn new(prefix: String) -> Self
Sourcepub fn declare_env(&self, builder: &mut FunctionBuilder<'_>)
pub fn declare_env(&self, builder: &mut FunctionBuilder<'_>)
Re-declare all heap pointers currently in the environment as needing stack map entries. Should be called after switching to a new block (e.g., merge blocks, join points, case alternatives) to ensure liveness is tracked correctly across block boundaries.
pub fn trace_scope(&self, msg: &str)
pub fn next_lambda_name(&mut self) -> String
pub fn next_thunk_name(&mut self) -> String
Auto Trait Implementations§
impl Freeze for EmitContext
impl RefUnwindSafe for EmitContext
impl Send for EmitContext
impl Sync for EmitContext
impl Unpin for EmitContext
impl UnsafeUnpin for EmitContext
impl UnwindSafe for EmitContext
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