From 8138d6664fb6983b10192f5a982a8bf5ec327287 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sun, 15 Dec 2024 23:15:07 +0100 Subject: [PATCH] properly releasing the strongrefs now Signed-off-by: Jakub Doka --- lang/src/son.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lang/src/son.rs b/lang/src/son.rs index 1e4be55..1a85bc2 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -2628,6 +2628,15 @@ impl Pool { fn restore_ci(&mut self, dst: &mut ItemCtx) { self.used_cis -= 1; dst.scope.clear(&mut dst.nodes); + dst.loops.drain(..).for_each(|mut l| { + l.ctrl.map(|c| { + if c.is_live() { + c.remove(&mut dst.nodes); + } + }); + l.scope.clear(&mut dst.nodes); + l.ctrl_scope.map(|mut s| s.clear(&mut dst.nodes)); + }); mem::take(&mut dst.ctrl).remove(&mut dst.nodes); *dst = mem::take(&mut self.cis[self.used_cis]); } @@ -5518,7 +5527,6 @@ impl<'a> Codegen<'a> { fn infer_type(&mut self, expr: &Expr) -> ty::Id { self.pool.save_ci(&self.ci); let ty = self.expr(expr).map_or(ty::Id::NEVER, |v| v.ty); - self.pool.restore_ci(&mut self.ci); ty }