Update wasm-tools crates (#3997)

* Update wasm-tools crates

This commit updates the wasm-tools family of crates as used in Wasmtime.
Notably this brings in the update which removes module linking support
as well as a number of internal refactorings around names and such
within wasmparser itself. This updates all of the wasm translation
support which binds to wasmparser as appropriate.

Other crates all had API-compatible changes for at least what Wasmtime
used so no further changes were necessary beyond updating version
requirements.

* Update a test expectation
This commit is contained in:
Alex Crichton
2022-04-05 14:32:33 -05:00
committed by GitHub
parent 7ac2598009
commit d147802d51
26 changed files with 178 additions and 299 deletions

View File

@@ -20,16 +20,19 @@ pub fn translate_module<'data>(
) -> WasmResult<ModuleTranslationState> {
let _tt = timing::wasm_translate_module();
let mut module_translation_state = ModuleTranslationState::new();
let mut validator = Validator::new();
validator.wasm_features(environ.wasm_features());
let mut validator = Validator::new_with_features(environ.wasm_features());
for payload in Parser::new(0).parse_all(data) {
match payload? {
Payload::Version { num, range } => {
validator.version(num, &range)?;
Payload::Version {
num,
encoding,
range,
} => {
validator.version(num, encoding, &range)?;
}
Payload::End => {
validator.end()?;
Payload::End(offset) => {
validator.end(offset)?;
}
Payload::TypeSection(types) => {
@@ -88,7 +91,7 @@ pub fn translate_module<'data>(
}
Payload::CodeSectionEntry(body) => {
let func_validator = validator.code_section_entry()?;
let func_validator = validator.code_section_entry(&body)?;
environ.define_function_body(func_validator, body)?;
}
@@ -104,28 +107,6 @@ pub fn translate_module<'data>(
environ.reserve_passive_data(count)?;
}
Payload::InstanceSection(s) => {
validator.instance_section(&s)?;
unimplemented!();
}
Payload::AliasSection(s) => {
validator.alias_section(&s)?;
unimplemented!();
}
Payload::ModuleSectionStart {
count,
range,
size: _,
} => {
validator.module_section_start(count, &range)?;
unimplemented!();
}
Payload::ModuleSectionEntry { .. } => {
validator.module_section_entry();
unimplemented!();
}
Payload::CustomSection {
name: "name",
data,
@@ -142,9 +123,9 @@ pub fn translate_module<'data>(
Payload::CustomSection { name, data, .. } => environ.custom_section(name, data)?,
Payload::UnknownSection { id, range, .. } => {
validator.unknown_section(id, &range)?;
unreachable!();
other => {
validator.payload(&other)?;
panic!("unimplemented section {:?}", other);
}
}
}