Skip to content

Commit

Permalink
refactor: use wasm::MAX_VARS for simplifying some expressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Nov 22, 2024
1 parent c68e8ae commit 172cfdf
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/src/compiler/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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");
}
}
Expand Down

0 comments on commit 172cfdf

Please sign in to comment.