From aeb5be5f146eff8f5f23aeb35f1787e3bbb54311 Mon Sep 17 00:00:00 2001 From: mlokr Date: Mon, 9 Sep 2024 23:31:22 +0200 Subject: [PATCH] prolly fixed --- hblang/src/codegen.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hblang/src/codegen.rs b/hblang/src/codegen.rs index 760cb03d..678c0cc9 100644 --- a/hblang/src/codegen.rs +++ b/hblang/src/codegen.rs @@ -2370,6 +2370,9 @@ impl Codegen { uses_left: v.uses_left, }) .collect(), + stack_relocs: self.ci.stack_relocs.clone(), + ret_relocs: self.ci.ret_relocs.clone(), + loop_relocs: self.ci.loop_relocs.clone(), ..Default::default() }; ci.regs.init(); @@ -2377,6 +2380,7 @@ impl Codegen { let value = self.expr(expr).unwrap(); self.ci.free_loc(value.loc); std::mem::swap(&mut self.ci, &mut ci); + self.ci.snap = ci.snap; snap._add(&self.ci.snap); self.output.trunc(&snap); value.ty @@ -3333,11 +3337,13 @@ impl Codegen { let entry = &mut self.output.code[self.ci.snap.code] as *mut _ as _; let prev_pc = std::mem::replace(&mut self.ct.vm.pc, hbvm::mem::Address::new(entry)); - #[cfg(test)] + #[cfg(debug_assertions)] { let mut vc = Vec::::new(); if self.disasm(&mut vc).is_err() { panic!("{}", String::from_utf8(vc).unwrap()); + } else { + log::inf!("{}", String::from_utf8(vc).unwrap()); } }