LibWasm: Hold on to the stack depth for expressions in the validator

This allows preallocating the value stack when pushing frames, avoiding
repeated reallocs and copies.
This commit is contained in:
Ali Mohammad Pur 2025-06-06 14:12:28 +02:00 committed by Ali Mohammad Pur
commit dc67f0ad4e
Notes: github-actions[bot] 2025-08-08 10:56:54 +00:00
4 changed files with 17 additions and 1 deletions

View file

@ -3736,6 +3736,8 @@ ErrorOr<Validator::ExpressionTypeResult, ValidationError> Validator::validate(Ex
m_frames.take_last();
VERIFY(m_frames.is_empty());
expression.set_stack_usage_hint(stack.max_known_size());
return ExpressionTypeResult { stack.release_vector(), is_constant_expression };
}