properly releasing the strongrefs now

Signed-off-by: Jakub Doka <jakub.doka2@gmail.com>
This commit is contained in:
Jakub Doka 2024-12-15 23:15:07 +01:00
parent 9f43e3bb92
commit 8138d6664f
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -2628,6 +2628,15 @@ impl Pool {
fn restore_ci(&mut self, dst: &mut ItemCtx) { fn restore_ci(&mut self, dst: &mut ItemCtx) {
self.used_cis -= 1; self.used_cis -= 1;
dst.scope.clear(&mut dst.nodes); 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); mem::take(&mut dst.ctrl).remove(&mut dst.nodes);
*dst = mem::take(&mut self.cis[self.used_cis]); *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 { fn infer_type(&mut self, expr: &Expr) -> ty::Id {
self.pool.save_ci(&self.ci); self.pool.save_ci(&self.ci);
let ty = self.expr(expr).map_or(ty::Id::NEVER, |v| v.ty); let ty = self.expr(expr).map_or(ty::Id::NEVER, |v| v.ty);
self.pool.restore_ci(&mut self.ci); self.pool.restore_ci(&mut self.ci);
ty ty
} }