From 735c7cb636edfd4704460c94a9c7d65e5bf4df48 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Sat, 9 Mar 2024 13:51:32 +0100 Subject: chore: improve documentation, tests Closes #6 Signed-off-by: Henry Gressmann --- crates/parser/src/visit.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crates/parser/src/visit.rs') diff --git a/crates/parser/src/visit.rs b/crates/parser/src/visit.rs index cc9f0e2..b438fc1 100644 --- a/crates/parser/src/visit.rs +++ b/crates/parser/src/visit.rs @@ -10,7 +10,6 @@ struct ValidateThenVisit<'a, T, U>(T, &'a mut U); macro_rules! validate_then_visit { ($( @$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident)*) => { $( - #[inline] fn $visit(&mut self $($(,$arg: $argty)*)?) -> Self::Output { self.0.$visit($($($arg.clone()),*)?)?; Ok(self.1.$visit($($($arg),*)?)) @@ -103,7 +102,7 @@ pub(crate) struct FunctionBuilder { impl FunctionBuilder { pub(crate) fn new(instr_capacity: usize) -> Self { - Self { instructions: Vec::with_capacity(instr_capacity), label_ptrs: Vec::with_capacity(128) } + Self { instructions: Vec::with_capacity(instr_capacity), label_ptrs: Vec::with_capacity(256) } } #[cold] @@ -391,7 +390,6 @@ impl<'a> wasmparser::VisitOperator<'a> for FunctionBuilder { self.visit(Instruction::Else(0)) } - #[inline] fn visit_end(&mut self) -> Self::Output { let Some(label_pointer) = self.label_ptrs.pop() else { return self.visit(Instruction::EndFunc); @@ -422,11 +420,11 @@ impl<'a> wasmparser::VisitOperator<'a> for FunctionBuilder { *else_offset = (label_pointer - if_label_pointer) .try_into() - .expect("else_instr_end_offset is too large, tinywasm does not support blocks that large"); + .expect("else_instr_end_offset is too large, tinywasm does not support blocks that large"); *end_offset = (current_instr_ptr - if_label_pointer) .try_into() - .expect("else_instr_end_offset is too large, tinywasm does not support blocks that large"); + .expect("else_instr_end_offset is too large, tinywasm does not support blocks that large"); } Instruction::Block(_, ref mut end_offset) | Instruction::Loop(_, ref mut end_offset) -- cgit v1.3.1