Update wasm-tools crates (#4246)

This commit updates the wasm-tools family of crates, notably pulling in
the refactorings and updates from bytecodealliance/wasm-tools#621 for
the latest iteration of the component model. This commit additionally
updates all support for the component model for these changes, notably:

* Many bits and pieces of type information was refactored. Many
  `FooTypeIndex` namings are now `TypeFooIndex`. Additionally there is
  now `TypeIndex` as well as `ComponentTypeIndex` for the two type index
  spaces in a component.

* A number of new sections are now processed to handle the core and
  component variants.

* Internal maps were split such as the `funcs` map into
  `component_funcs` and `funcs` (same for `instances`).

* Canonical options are now processed individually instead of one bulk
  `into` definition.

Overall this was not a major update to the internals of handling the
component model in Wasmtime. Instead this was mostly a surface-level
refactoring to make sure that everything lines up with the new binary
format for components.

* All text syntax used in tests was updated to the new syntax.
This commit is contained in:
Alex Crichton
2022-06-09 11:16:07 -05:00
committed by GitHub
parent c15c3061ca
commit 7d7ddceb17
32 changed files with 1201 additions and 1078 deletions

View File

@@ -12,4 +12,4 @@ edition = "2021"
cranelift-entity = { path = "../../cranelift/entity", version = "0.86.0", features = ['enable-serde'] }
serde = { version = "1.0.94", features = ["derive"] }
thiserror = "1.0.4"
wasmparser = { version = "0.85.0", default-features = false }
wasmparser = { version = "0.86.0", default-features = false }

View File

@@ -31,10 +31,10 @@ pub enum WasmType {
ExternRef,
}
impl TryFrom<wasmparser::Type> for WasmType {
impl TryFrom<wasmparser::ValType> for WasmType {
type Error = WasmError;
fn try_from(ty: wasmparser::Type) -> Result<Self, Self::Error> {
use wasmparser::Type::*;
fn try_from(ty: wasmparser::ValType) -> Result<Self, Self::Error> {
use wasmparser::ValType::*;
match ty {
I32 => Ok(WasmType::I32),
I64 => Ok(WasmType::I64),
@@ -47,16 +47,16 @@ impl TryFrom<wasmparser::Type> for WasmType {
}
}
impl From<WasmType> for wasmparser::Type {
fn from(ty: WasmType) -> wasmparser::Type {
impl From<WasmType> for wasmparser::ValType {
fn from(ty: WasmType) -> wasmparser::ValType {
match ty {
WasmType::I32 => wasmparser::Type::I32,
WasmType::I64 => wasmparser::Type::I64,
WasmType::F32 => wasmparser::Type::F32,
WasmType::F64 => wasmparser::Type::F64,
WasmType::V128 => wasmparser::Type::V128,
WasmType::FuncRef => wasmparser::Type::FuncRef,
WasmType::ExternRef => wasmparser::Type::ExternRef,
WasmType::I32 => wasmparser::ValType::I32,
WasmType::I64 => wasmparser::ValType::I64,
WasmType::F32 => wasmparser::ValType::F32,
WasmType::F64 => wasmparser::ValType::F64,
WasmType::V128 => wasmparser::ValType::V128,
WasmType::FuncRef => wasmparser::ValType::FuncRef,
WasmType::ExternRef => wasmparser::ValType::ExternRef,
}
}
}