Update wasm-tools crates (#5248)

No major updates, just keeping up-to-date.
This commit is contained in:
Alex Crichton
2022-11-10 15:23:20 -06:00
committed by GitHub
parent 7ec626b898
commit 0548952319
7 changed files with 100 additions and 70 deletions

View File

@@ -94,21 +94,21 @@ where
&mut self.regalloc,
);
let mut visitor = ValidateThenVisit(&mut validator, self);
while !body.eof() {
body.visit_operator(&mut visitor)??;
let offset = body.original_position();
body.visit_operator(&mut ValidateThenVisit(validator.visitor(offset), self))??;
}
validator.finish(body.original_position())?;
return Ok(());
struct ValidateThenVisit<'a, T, U>(&'a mut T, &'a mut U);
struct ValidateThenVisit<'a, T, U>(T, &'a mut U);
macro_rules! validate_then_visit {
($( @$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident)*) => {
$(
fn $visit(&mut self, offset: usize $($(,$arg: $argty)*)?) -> Self::Output {
self.0.$visit(offset, $($($arg.clone()),*)?)?;
Ok(self.1.$visit(offset, $($($arg),*)?))
fn $visit(&mut self $($(,$arg: $argty)*)?) -> Self::Output {
self.0.$visit($($($arg.clone()),*)?)?;
Ok(self.1.$visit($($($arg),*)?))
}
)*
};

View File

@@ -62,7 +62,7 @@ macro_rules! def_unsupported {
emit
$op
fn $visit(&mut self, _offset: usize $($(,$arg: $argty)*)?) -> Self::Output {
fn $visit(&mut self $($(,$arg: $argty)*)?) -> Self::Output {
$($(drop($arg);)*)?
todo!(stringify!($op))
}
@@ -85,11 +85,11 @@ where
{
type Output = ();
fn visit_i32_const(&mut self, _offset: usize, val: i32) {
fn visit_i32_const(&mut self, val: i32) {
self.context.stack.push(Val::i32(val));
}
fn visit_i32_add(&mut self, _offset: usize) {
fn visit_i32_add(&mut self) {
let is_const = self
.context
.stack
@@ -104,9 +104,9 @@ where
}
}
fn visit_end(&mut self, _offset: usize) {}
fn visit_end(&mut self) {}
fn visit_local_get(&mut self, _offset: usize, index: u32) {
fn visit_local_get(&mut self, index: u32) {
let context = &mut self.context;
let slot = context
.frame
@@ -119,7 +119,7 @@ where
}
// TODO verify the case where the target local is on the stack.
fn visit_local_set(&mut self, _offset: usize, index: u32) {
fn visit_local_set(&mut self, index: u32) {
let context = &mut self.context;
let frame = context.frame;
let slot = frame