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

34
Cargo.lock generated
View File

@@ -3256,18 +3256,18 @@ checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744"
[[package]] [[package]]
name = "wasm-encoder" name = "wasm-encoder"
version = "0.19.0" version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5816e88e8ea7335016aa62eb0485747f786136d505a9b3890f8c400211d9b5f" checksum = "9424cdab516a16d4ea03c8f4a01b14e7b2d04a129dcc2bcdde5bcc5f68f06c41"
dependencies = [ dependencies = [
"leb128", "leb128",
] ]
[[package]] [[package]]
name = "wasm-mutate" name = "wasm-mutate"
version = "0.2.10" version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95d890340857014cfaad5db9d37154416de7110520ee515b0d9b1d7f29c7b137" checksum = "b48cf16265251b7e11c57686ea068a77c87a67aada5cff4ee8dd50382820f01b"
dependencies = [ dependencies = [
"egg", "egg",
"log", "log",
@@ -3279,9 +3279,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-smith" name = "wasm-smith"
version = "0.11.7" version = "0.11.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f89c6660d167214d00fc9e906c75ac1b1c22e1ca6f82f379440d804b63e6fcd5" checksum = "f351bb8188460a311bceb4e2fd7423e09ba5c4a16fc03f3b258f454c4d706881"
dependencies = [ dependencies = [
"arbitrary", "arbitrary",
"flagset", "flagset",
@@ -3332,9 +3332,9 @@ dependencies = [
[[package]] [[package]]
name = "wasmparser" name = "wasmparser"
version = "0.93.0" version = "0.94.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5a4460aa3e271fa180b6a5d003e728f3963fb30e3ba0fa7c9634caa06049328" checksum = "cdac7e1d98d70913ae3b4923dd7419c8ea7bdfd4c44a240a0ba305d929b7f191"
dependencies = [ dependencies = [
"indexmap", "indexmap",
] ]
@@ -3350,9 +3350,9 @@ dependencies = [
[[package]] [[package]]
name = "wasmprinter" name = "wasmprinter"
version = "0.2.42" version = "0.2.43"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c9f096ba095329c6aa55b7e9cafa26c5b50e9ab7fc2415fd0b26cb80dca8f05" checksum = "9c093ddb9e6526cc59d93032b9be7a8d014cc997e8a9372f394c9624f820d209"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"wasmparser", "wasmparser",
@@ -3499,7 +3499,7 @@ dependencies = [
"wasmtime-wasi-crypto", "wasmtime-wasi-crypto",
"wasmtime-wasi-nn", "wasmtime-wasi-nn",
"wasmtime-wast", "wasmtime-wast",
"wast 48.0.0", "wast 49.0.0",
"wat", "wat",
"windows-sys", "windows-sys",
] ]
@@ -3768,7 +3768,7 @@ dependencies = [
"anyhow", "anyhow",
"log", "log",
"wasmtime", "wasmtime",
"wast 48.0.0", "wast 49.0.0",
] ]
[[package]] [[package]]
@@ -3793,9 +3793,9 @@ dependencies = [
[[package]] [[package]]
name = "wast" name = "wast"
version = "48.0.0" version = "49.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84825b5ac7164df8260c9e2b2e814075334edbe7ac426f2469b93a5eeac23cce" checksum = "05ef81fcd60d244cafffeafac3d17615fdb2fddda6aca18f34a8ae233353587c"
dependencies = [ dependencies = [
"leb128", "leb128",
"memchr", "memchr",
@@ -3805,11 +3805,11 @@ dependencies = [
[[package]] [[package]]
name = "wat" name = "wat"
version = "1.0.50" version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "129da4a03ec6d2a815f42c88f641824e789d5be0d86d2f90aa8a218c7068e0be" checksum = "4c347c4460ffb311e95aafccd8c29e4888f241b9e4b3bb0e0ccbd998de2c8c0d"
dependencies = [ dependencies = [
"wast 48.0.0", "wast 49.0.0",
] ]
[[package]] [[package]]

View File

@@ -154,13 +154,13 @@ winch-codegen = { path = "winch/codegen", version = "=0.2.0" }
target-lexicon = { version = "0.12.3", default-features = false } target-lexicon = { version = "0.12.3", default-features = false }
anyhow = "1.0.22" anyhow = "1.0.22"
wasmparser = "0.93.0" wasmparser = "0.94.0"
wat = "1.0.50" wat = "1.0.51"
wast = "48.0.0" wast = "49.0.0"
wasmprinter = "0.2.42" wasmprinter = "0.2.43"
wasm-encoder = "0.19.0" wasm-encoder = "0.19.1"
wasm-smith = "0.11.7" wasm-smith = "0.11.8"
wasm-mutate = "0.2.10" wasm-mutate = "0.2.11"
windows-sys = "0.36.0" windows-sys = "0.36.0"
env_logger = "0.9" env_logger = "0.9"
rustix = "0.35.10" rustix = "0.35.10"

View File

@@ -395,35 +395,27 @@ pub fn parse_name_section<'data>(
) -> WasmResult<()> { ) -> WasmResult<()> {
for subsection in names { for subsection in names {
match subsection? { match subsection? {
wasmparser::Name::Function(f) => { wasmparser::Name::Function(names) => {
let mut names = f.get_map()?; for name in names {
for _ in 0..names.get_count() { let Naming { index, name } = name?;
let Naming { index, name } = names.read()?;
// We reserve `u32::MAX` for our own use in cranelift-entity. // We reserve `u32::MAX` for our own use in cranelift-entity.
if index != u32::max_value() { if index != u32::max_value() {
environ.declare_func_name(FuncIndex::from_u32(index), name); environ.declare_func_name(FuncIndex::from_u32(index), name);
} }
} }
} }
wasmparser::Name::Module(module) => { wasmparser::Name::Module { name, .. } => {
let name = module.get_name()?;
environ.declare_module_name(name); environ.declare_module_name(name);
} }
wasmparser::Name::Local(l) => { wasmparser::Name::Local(reader) => {
let mut reader = l.get_indirect_map()?; for f in reader {
for _ in 0..reader.get_indirect_count() { let f = f?;
let f = reader.read()?; if f.index == u32::max_value() {
if f.indirect_index == u32::max_value() {
continue; continue;
} }
let mut map = f.get_map()?; for name in f.names {
for _ in 0..map.get_count() { let Naming { index, name } = name?;
let Naming { index, name } = map.read()?; environ.declare_local_name(FuncIndex::from_u32(f.index), index, name)
environ.declare_local_name(
FuncIndex::from_u32(f.indirect_index),
index,
name,
)
} }
} }
} }

View File

@@ -774,10 +774,9 @@ and for re-adding support for interface types you can see this issue:
fn name_section(&mut self, names: NameSectionReader<'data>) -> WasmResult<()> { fn name_section(&mut self, names: NameSectionReader<'data>) -> WasmResult<()> {
for subsection in names { for subsection in names {
match subsection? { match subsection? {
wasmparser::Name::Function(f) => { wasmparser::Name::Function(names) => {
let mut names = f.get_map()?; for name in names {
for _ in 0..names.get_count() { let Naming { index, name } = name?;
let Naming { index, name } = names.read()?;
// Skip this naming if it's naming a function that // Skip this naming if it's naming a function that
// doesn't actually exist. // doesn't actually exist.
if (index as usize) >= self.result.module.functions.len() { if (index as usize) >= self.result.module.functions.len() {
@@ -796,34 +795,31 @@ and for re-adding support for interface types you can see this issue:
.insert(index, name); .insert(index, name);
} }
} }
wasmparser::Name::Module(module) => { wasmparser::Name::Module { name, .. } => {
let name = module.get_name()?;
self.result.module.name = Some(name.to_string()); self.result.module.name = Some(name.to_string());
if self.tunables.generate_native_debuginfo { if self.tunables.generate_native_debuginfo {
self.result.debuginfo.name_section.module_name = Some(name); self.result.debuginfo.name_section.module_name = Some(name);
} }
} }
wasmparser::Name::Local(l) => { wasmparser::Name::Local(reader) => {
if !self.tunables.generate_native_debuginfo { if !self.tunables.generate_native_debuginfo {
continue; continue;
} }
let mut reader = l.get_indirect_map()?; for f in reader {
for _ in 0..reader.get_indirect_count() { let f = f?;
let f = reader.read()?;
// Skip this naming if it's naming a function that // Skip this naming if it's naming a function that
// doesn't actually exist. // doesn't actually exist.
if (f.indirect_index as usize) >= self.result.module.functions.len() { if (f.index as usize) >= self.result.module.functions.len() {
continue; continue;
} }
let mut map = f.get_map()?; for name in f.names {
for _ in 0..map.get_count() { let Naming { index, name } = name?;
let Naming { index, name } = map.read()?;
self.result self.result
.debuginfo .debuginfo
.name_section .name_section
.locals_names .locals_names
.entry(FuncIndex::from_u32(f.indirect_index)) .entry(FuncIndex::from_u32(f.index))
.or_insert(HashMap::new()) .or_insert(HashMap::new())
.insert(index, name); .insert(index, name);
} }

View File

@@ -370,6 +370,12 @@ criteria = "safe-to-deploy"
version = "0.19.0" version = "0.19.0"
notes = "The Bytecode Alliance is the author of this crate." notes = "The Bytecode Alliance is the author of this crate."
[[audits.wasm-encoder]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
delta = "0.19.0 -> 0.19.1"
notes = "The Bytecode Alliance is the author of this crate."
[[audits.wasm-mutate]] [[audits.wasm-mutate]]
who = "Alex Crichton <alex@alexcrichton.com>" who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
@@ -406,6 +412,12 @@ criteria = "safe-to-run"
version = "0.2.10" version = "0.2.10"
notes = "The Bytecode Alliance is the author of this crate." notes = "The Bytecode Alliance is the author of this crate."
[[audits.wasm-mutate]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-run"
version = "0.2.11"
notes = "The Bytecode Alliance is the author of this crate."
[[audits.wasm-smith]] [[audits.wasm-smith]]
who = "Alex Crichton <alex@alexcrichton.com>" who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
@@ -442,6 +454,12 @@ criteria = "safe-to-run"
version = "0.11.7" version = "0.11.7"
notes = "The Bytecode Alliance is the author of this crate." notes = "The Bytecode Alliance is the author of this crate."
[[audits.wasm-smith]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-run"
version = "0.11.8"
notes = "The Bytecode Alliance is the author of this crate."
[[audits.wasmi_arena]] [[audits.wasmi_arena]]
who = "Alex Crichton <alex@alexcrichton.com>" who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-run" criteria = "safe-to-run"
@@ -505,6 +523,12 @@ criteria = "safe-to-deploy"
version = "0.93.0" version = "0.93.0"
notes = "The Bytecode Alliance is the author of this crate." notes = "The Bytecode Alliance is the author of this crate."
[[audits.wasmparser]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
version = "0.94.0"
notes = "The Bytecode Alliance is the author of this crate."
[[audits.wasmparser-nostd]] [[audits.wasmparser-nostd]]
who = "Alex Crichton <alex@alexcrichton.com>" who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-run" criteria = "safe-to-run"
@@ -552,6 +576,12 @@ criteria = "safe-to-deploy"
version = "0.2.42" version = "0.2.42"
notes = "The Bytecode Alliance is the author of this crate." notes = "The Bytecode Alliance is the author of this crate."
[[audits.wasmprinter]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
version = "0.2.43"
notes = "The Bytecode Alliance is the author of this crate."
[[audits.wast]] [[audits.wast]]
who = "Alex Crichton <alex@alexcrichton.com>" who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
@@ -594,6 +624,12 @@ criteria = "safe-to-deploy"
version = "48.0.0" version = "48.0.0"
notes = "The Bytecode Alliance is the author of this crate." notes = "The Bytecode Alliance is the author of this crate."
[[audits.wast]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
version = "49.0.0"
notes = "The Bytecode Alliance is the author of this crate."
[[audits.wat]] [[audits.wat]]
who = "Alex Crichton <alex@alexcrichton.com>" who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
@@ -618,6 +654,12 @@ criteria = "safe-to-deploy"
version = "1.0.50" version = "1.0.50"
notes = "The Bytecode Alliance is the author of this crate." notes = "The Bytecode Alliance is the author of this crate."
[[audits.wat]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
version = "1.0.51"
notes = "The Bytecode Alliance is the author of this crate."
[[audits.wat]] [[audits.wat]]
who = "Alex Crichton <alex@alexcrichton.com>" who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"

View File

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

View File

@@ -62,7 +62,7 @@ macro_rules! def_unsupported {
emit emit
$op $op
fn $visit(&mut self, _offset: usize $($(,$arg: $argty)*)?) -> Self::Output { fn $visit(&mut self $($(,$arg: $argty)*)?) -> Self::Output {
$($(drop($arg);)*)? $($(drop($arg);)*)?
todo!(stringify!($op)) todo!(stringify!($op))
} }
@@ -85,11 +85,11 @@ where
{ {
type Output = (); 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)); 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 let is_const = self
.context .context
.stack .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 context = &mut self.context;
let slot = context let slot = context
.frame .frame
@@ -119,7 +119,7 @@ where
} }
// TODO verify the case where the target local is on the stack. // 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 context = &mut self.context;
let frame = context.frame; let frame = context.frame;
let slot = frame let slot = frame