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:
@@ -6,7 +6,7 @@ use std::vec::Vec;
|
||||
|
||||
/// Map of signatures to a function's parameter and return types.
|
||||
pub(crate) type WasmTypes =
|
||||
PrimaryMap<SignatureIndex, (Box<[wasmparser::Type]>, Box<[wasmparser::Type]>)>;
|
||||
PrimaryMap<SignatureIndex, (Box<[wasmparser::ValType]>, Box<[wasmparser::ValType]>)>;
|
||||
|
||||
/// Contains information decoded from the Wasm module that must be referenced
|
||||
/// during each Wasm function's translation.
|
||||
@@ -23,13 +23,13 @@ pub struct ModuleTranslationState {
|
||||
pub(crate) wasm_types: WasmTypes,
|
||||
}
|
||||
|
||||
fn cranelift_to_wasmparser_type(ty: Type) -> WasmResult<wasmparser::Type> {
|
||||
fn cranelift_to_wasmparser_type(ty: Type) -> WasmResult<wasmparser::ValType> {
|
||||
Ok(match ty {
|
||||
types::I32 => wasmparser::Type::I32,
|
||||
types::I64 => wasmparser::Type::I64,
|
||||
types::F32 => wasmparser::Type::F32,
|
||||
types::F64 => wasmparser::Type::F64,
|
||||
types::R32 | types::R64 => wasmparser::Type::ExternRef,
|
||||
types::I32 => wasmparser::ValType::I32,
|
||||
types::I64 => wasmparser::ValType::I64,
|
||||
types::F32 => wasmparser::ValType::F32,
|
||||
types::F64 => wasmparser::ValType::F64,
|
||||
types::R32 | types::R64 => wasmparser::ValType::ExternRef,
|
||||
_ => {
|
||||
return Err(WasmError::Unsupported(format!(
|
||||
"Cannot convert Cranelift type to Wasm signature: {:?}",
|
||||
@@ -54,11 +54,11 @@ impl ModuleTranslationState {
|
||||
pub fn from_func_sigs(sigs: &[(&[Type], &[Type])]) -> WasmResult<Self> {
|
||||
let mut wasm_types = PrimaryMap::with_capacity(sigs.len());
|
||||
for &(ref args, ref results) in sigs {
|
||||
let args: Vec<wasmparser::Type> = args
|
||||
let args: Vec<wasmparser::ValType> = args
|
||||
.iter()
|
||||
.map(|&ty| cranelift_to_wasmparser_type(ty))
|
||||
.collect::<Result<_, _>>()?;
|
||||
let results: Vec<wasmparser::Type> = results
|
||||
let results: Vec<wasmparser::ValType> = results
|
||||
.iter()
|
||||
.map(|&ty| cranelift_to_wasmparser_type(ty))
|
||||
.collect::<Result<_, _>>()?;
|
||||
|
||||
Reference in New Issue
Block a user