From 172cfdfbe9ac9d92e88659621c7aba8380db32bc Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Fri, 22 Nov 2024 12:36:24 +0100 Subject: [PATCH] refactor: use `wasm::MAX_VARS` for simplifying some expressions. --- lib/src/compiler/context.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/src/compiler/context.rs b/lib/src/compiler/context.rs index aa9a0571..bc7f86f5 100644 --- a/lib/src/compiler/context.rs +++ b/lib/src/compiler/context.rs @@ -189,9 +189,7 @@ impl VarStack { self.used += capacity; self.frame_id += 1; - if self.used * Var::mem_size() - > wasm::VARS_STACK_END - wasm::VARS_STACK_START - { + if self.used > wasm::MAX_VARS { panic!("variables stack overflow"); } @@ -273,9 +271,7 @@ impl Var { if self.index >= from_index { self.index += shift_amount; } - if self.index * Var::mem_size() - >= wasm::VARS_STACK_END - wasm::VARS_STACK_START - { + if self.index >= wasm::MAX_VARS { panic!("variables stack overflow during shift"); } }