Update wasm-tools dependencies (#4970)

* Update wasm-tools dependencies

This update brings in a number of features such as:

* The component model binary format and AST has been slightly adjusted
  in a few locations. Names are dropped from parameters/results now in
  the internal representation since they were not used anyway. At this
  time the ability to bind a multi-return function has not been exposed.

* The `wasmparser` validator pass will now share allocations with prior
  functions, providing what's probably a very minor speedup for Wasmtime
  itself.

* The text format for many component-related tests now requires named
  parameters.

* Some new relaxed-simd instructions are updated to be ignored.

I hope to have a follow-up to expose the multi-return ability to the
embedding API of components.

* Update audit information for new crates
This commit is contained in:
Alex Crichton
2022-09-27 13:12:34 -05:00
committed by GitHub
parent 10deb9b7fe
commit 29c7de7340
31 changed files with 407 additions and 331 deletions

View File

@@ -246,10 +246,8 @@ impl Func {
let data = &store[self.0];
let ty = &data.types[data.ty];
Params::typecheck_named_list(&ty.params, &data.types)
.context("type mismatch with parameters")?;
Return::typecheck_named_list(&ty.results, &data.types)
.context("type mismatch with results")?;
Params::typecheck_list(&ty.params, &data.types).context("type mismatch with parameters")?;
Return::typecheck_list(&ty.results, &data.types).context("type mismatch with results")?;
Ok(())
}
@@ -260,7 +258,7 @@ impl Func {
data.types[data.ty]
.params
.iter()
.map(|(_, ty)| Type::from(ty, &data.types))
.map(|ty| Type::from(ty, &data.types))
.collect()
}
@@ -270,7 +268,7 @@ impl Func {
data.types[data.ty]
.results
.iter()
.map(|(_, ty)| Type::from(ty, &data.types))
.map(|ty| Type::from(ty, &data.types))
.collect()
}

View File

@@ -89,16 +89,8 @@ impl HostFunc {
func: Box::new(DynamicContext {
func,
types: Types {
params: ty
.params
.iter()
.map(|(_, ty)| Type::from(ty, types))
.collect(),
results: ty
.results
.iter()
.map(|(_, ty)| Type::from(ty, types))
.collect(),
params: ty.params.iter().map(|ty| Type::from(ty, types)).collect(),
results: ty.results.iter().map(|ty| Type::from(ty, types)).collect(),
},
}),
})
@@ -123,8 +115,8 @@ where
R: ComponentNamedList + Lower,
{
let ty = &types[ty];
P::typecheck_named_list(&ty.params, types).context("type mismatch with parameters")?;
R::typecheck_named_list(&ty.results, types).context("type mismatch with results")?;
P::typecheck_list(&ty.params, types).context("type mismatch with parameters")?;
R::typecheck_list(&ty.results, types).context("type mismatch with results")?;
Ok(())
}

View File

@@ -308,10 +308,7 @@ pub unsafe trait ComponentNamedList: ComponentType {
/// Performs a typecheck to ensure that this `ComponentNamedList`
/// implementor matches the types of the types in `params`.
#[doc(hidden)]
fn typecheck_named_list(
params: &[(Option<String>, InterfaceType)],
types: &ComponentTypes,
) -> Result<()>;
fn typecheck_list(params: &[InterfaceType], types: &ComponentTypes) -> Result<()>;
}
/// A trait representing types which can be passed to and read from components
@@ -1965,14 +1962,14 @@ macro_rules! impl_component_ty_for_tuples {
unsafe impl<$($t,)*> ComponentNamedList for ($($t,)*)
where $($t: ComponentType),*
{
fn typecheck_named_list(
names: &[(Option<String>, InterfaceType)],
fn typecheck_list(
names: &[InterfaceType],
_types: &ComponentTypes,
) -> Result<()> {
if names.len() != $n {
bail!("expected {} types, found {}", $n, names.len());
}
let mut names = names.iter().map(|i| &i.1);
let mut names = names.iter();
$($t::typecheck(names.next().unwrap(), _types)?;)*
debug_assert!(names.next().is_none());
Ok(())

View File

@@ -590,7 +590,13 @@ impl Module {
}
}
engine.run_maybe_parallel(functions, |(mut validator, body)| validator.validate(&body))?;
engine.run_maybe_parallel(functions, |(validator, body)| {
// FIXME: it would be best here to use a rayon-specific parallel
// iterator that maintains state-per-thread to share the function
// validator allocations (`Default::default` here) across multiple
// functions.
validator.into_validator(Default::default()).validate(&body)
})?;
Ok(())
}