From cc29418323e473c81ea046697e4bf0007f55e556 Mon Sep 17 00:00:00 2001 From: Zhou Fang <33002388+zhou-w-fang@users.noreply.github.com> Date: Sun, 27 Oct 2024 20:57:44 -0700 Subject: [PATCH] fix: review --- crates/interpreter/src/valid.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/interpreter/src/valid.rs b/crates/interpreter/src/valid.rs index 20b54636..f676ef25 100644 --- a/crates/interpreter/src/valid.rs +++ b/crates/interpreter/src/valid.rs @@ -459,9 +459,9 @@ impl SideTable { fn pop_cnt(source: SideTableBranch, target: SideTableBranch) -> MResult { let source = source.stack; let target = target.stack; - let Some(delta) = target.checked_sub(source) else { + let Some(delta) = source.checked_sub(target) else { #[cfg(feature = "debug")] - eprintln!("side-table negative stack delta {target} < {source}"); + eprintln!("side-table negative stack delta {source} < {target}"); return Err(unsupported(if_debug!(Unsupported::SideTable))); }; u32::try_from(delta).map_err(|_| { @@ -880,6 +880,7 @@ impl<'a, 'm> Expr<'a, 'm> { fn branch_source(&mut self, result: usize) -> SideTableBranch<'m> { let mut branch = self.branch_target(); branch.result = result; + branch.stack += self.stack().len(); self.side_table.branch(); branch }