From 70f9ae0095cd02673ae5e6a5ed4e5bba0eee8a8c Mon Sep 17 00:00:00 2001 From: Zhou Fang <33002388+zhouwfang@users.noreply.github.com> Date: Fri, 27 Dec 2024 02:19:19 -0800 Subject: [PATCH] Add debug asserts for `val_cnt` and `pop_cnt` in side table (#709) #46 --------- Co-authored-by: Zhou Fang <33002388+zhou-w-fang@users.noreply.github.com> --- crates/interpreter/src/exec.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/interpreter/src/exec.rs b/crates/interpreter/src/exec.rs index 075305ff..ab7904ed 100644 --- a/crates/interpreter/src/exec.rs +++ b/crates/interpreter/src/exec.rs @@ -1048,8 +1048,11 @@ impl<'m> Thread<'m> { return self.exit_frame(); } let frame = self.frame(); + let side_table_entry = frame.side_table[offset].view(); let values_cnt: usize = frame.labels[i ..].iter().map(|label| label.values_cnt).sum(); let Label { arity, .. } = frame.labels.drain(i ..).next().unwrap(); + debug_assert_eq!(arity as u32, side_table_entry.val_cnt); + debug_assert_eq!(values_cnt as u32 - arity as u32, side_table_entry.pop_cnt); let values_len = self.values().len(); self.values().drain(values_len - values_cnt .. values_len - arity); self.label().values_cnt += arity;