Skip to content

Commit

Permalink
Add debug asserts for val_cnt and pop_cnt in side table (#709)
Browse files Browse the repository at this point in the history
#46

---------

Co-authored-by: Zhou Fang <[email protected]>
  • Loading branch information
zhouwfang and zhouwfang authored Dec 27, 2024
1 parent 9d47336 commit 70f9ae0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/interpreter/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 70f9ae0

Please sign in to comment.