diff --git a/lang/src/son.rs b/lang/src/son.rs index fe102504..c2def59f 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -998,6 +998,7 @@ impl Nodes { self.lock(target); for i in self[target].outputs.clone() { if self[i].kind == Kind::Phi { + self.queued_peeps.extend(self[i].outputs.clone()); self.replace(i, self[i].inputs[side]); } } @@ -1383,6 +1384,7 @@ impl Nodes { self.remove(prev); self.unlock(o); + self.queued_peeps.extend(self[o].outputs.clone()); self.replace(o, self[o].inputs[1]); } } @@ -1436,6 +1438,10 @@ impl Nodes { let ctrl = &self[cursor]; // TODO: do more inteligent checks on the condition if matches!(ctrl.kind, Kind::Then | Kind::Else) { + if self[ctrl.inputs[0]].kind == Kind::End { + return CondOptRes::Unknown; + } + debug_assert_eq!(self[ctrl.inputs[0]].kind, Kind::If); let other_cond = self[ctrl.inputs[0]].inputs[1]; if let Some(value) = self.matches_cond(cond, other_cond) { return CondOptRes::Known { diff --git a/lang/src/son/hbvm/regalloc.rs b/lang/src/son/hbvm/regalloc.rs index 6cb45357..452f3320 100644 --- a/lang/src/son/hbvm/regalloc.rs +++ b/lang/src/son/hbvm/regalloc.rs @@ -299,12 +299,12 @@ impl HbvmBackend { self.ralloc = res; let bundle_count = self.ralloc.bundles.len() + (reg_offset as usize); + debug_assert!(bundle_count < reg::STACK_PTR as usize, "TODO: spill memory"); ( if tail { - assert!(bundle_count < reg::STACK_PTR as usize, "TODO: spill memory"); - self.ralloc.bundles.len() - } else { bundle_count.saturating_sub((reg::RET_ADDR - 1) as _) + } else { + self.ralloc.bundles.len() }, tail, ) diff --git a/lang/tests/son_tests_something_somehow.txt b/lang/tests/son_tests_something_somehow.txt new file mode 100644 index 00000000..e69de29b