Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 70 additions & 70 deletions Cargo.lock

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -351,18 +351,18 @@ wit-bindgen = { version = "0.57.0", default-features = false }
wit-bindgen-rust-macro = { version = "0.57.0", default-features = false }

# wasm-tools family:
wasmparser = { version = "0.248.0", default-features = false, features = ['simd'] }
wat = "1.248.0"
wast = "248.0.0"
wasmprinter = "0.248.0"
wasm-encoder = "0.248.0"
wasm-smith = "0.248.0"
wasm-mutate = "0.248.0"
wit-parser = "0.248.0"
wit-component = "0.248.0"
wasm-wave = "0.248.0"
wasm-compose = { version = "0.248.0", default-features = false }
json-from-wast = "0.248.0"
wasmparser = { version = "0.249.0", default-features = false, features = ['simd'] }
wat = "1.249.0"
wast = "249.0.0"
wasmprinter = "0.249.0"
wasm-encoder = "0.249.0"
wasm-smith = "0.249.0"
wasm-mutate = "0.249.0"
wit-parser = "0.249.0"
wit-component = "0.249.0"
wasm-wave = "0.249.0"
wasm-compose = { version = "0.249.0", default-features = false }
json-from-wast = "0.249.0"

wstd = "0.6.5"
wasip2 = "1.0"
Expand Down
21 changes: 11 additions & 10 deletions crates/environ/src/component/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use wasmparser::component_types::{
ComponentFuncTypeId, ComponentInstanceTypeId, ComponentValType,
};
use wasmparser::types::Types;
use wasmparser::{Chunk, ComponentImportName, Encoding, Parser, Payload, Validator};
use wasmparser::{Chunk, ComponentExternName, Encoding, Parser, Payload, Validator};

mod adapt;
pub use self::adapt::*;
Expand Down Expand Up @@ -176,7 +176,7 @@ struct Translation<'data> {
// is straight from `wasmparser`'s passes.
enum LocalInitializer<'data> {
// imports
Import(ComponentImportName<'data>, ComponentEntityType),
Import(ComponentExternName<'data>, ComponentEntityType),

// An import of an intrinsic for compile-time builtins.
IntrinsicsImport,
Expand Down Expand Up @@ -768,11 +768,12 @@ impl<'a, 'data> Translator<'a, 'data> {
let import = import?;
let types = self.validator.types(0).unwrap();
let ty = types
.component_entity_type_of_import(import.name.0)
.unwrap();
.component_item_for_import(import.name.name)
.unwrap()
.ty;

if self.is_unsafe_intrinsics_import(import.name.0) {
self.check_unsafe_intrinsics_import(import.name.0, ty)?;
if self.is_unsafe_intrinsics_import(import.name.name) {
self.check_unsafe_intrinsics_import(import.name.name, ty)?;
self.result
.initializers
.push(LocalInitializer::IntrinsicsImport);
Expand Down Expand Up @@ -1309,7 +1310,7 @@ impl<'a, 'data> Translator<'a, 'data> {
for export in s {
let export = export?;
let item = self.kind_to_item(export.kind, export.index)?;
let prev = self.result.exports.insert(export.name.0, item);
let prev = self.result.exports.insert(export.name.name, item);
assert!(prev.is_none());
self.result
.initializers
Expand Down Expand Up @@ -1451,7 +1452,7 @@ impl<'a, 'data> Translator<'a, 'data> {
let mut map = HashMap::with_capacity(exports.len());
for export in exports {
let idx = self.kind_to_item(export.kind, export.index)?;
map.insert(export.name.0, idx);
map.insert(export.name.name, idx);
}

Ok(LocalInitializer::ComponentSynthetic(map, ty))
Expand Down Expand Up @@ -1662,13 +1663,13 @@ impl<'a, 'data> Translator<'a, 'data> {
);

for (name, ty) in &instance_ty.exports {
let ComponentEntityType::Func(func_ty) = ty else {
let ComponentEntityType::Func(func_ty) = ty.ty else {
bail!(
"bad unsafe intrinsics import: imported instance `{import}` must \
only export functions"
)
};
let func_ty = &types[*func_ty];
let func_ty = &types[func_ty];

fn ty_eq(a: &InterfaceType, b: &wasmparser::component_types::ComponentValType) -> bool {
use wasmparser::{PrimitiveValType as P, component_types::ComponentValType as C};
Expand Down
9 changes: 6 additions & 3 deletions crates/environ/src/component/translate/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,12 @@ pub(super) fn run(
if let TypeDef::Interface(_) = ty {
continue;
}
let index = inliner.result.import_types.push((name.0.to_string(), ty));
let index = inliner
.result
.import_types
.push((name.name.to_string(), ty));
let path = ImportPath::root(index);
args.insert(name.0, ComponentItemDef::from_import(path, ty)?);
args.insert(name.name, ComponentItemDef::from_import(path, ty)?);
}

// This will run the inliner to completion after being seeded with the
Expand Down Expand Up @@ -441,7 +444,7 @@ impl<'a> Inliner<'a> {
// was provided as an import at the instantiation-site to what was
// needed during the component's instantiation.
Import(name, ty) => {
let arg = match frame.args.get(name.0) {
let arg = match frame.args.get(name.name) {
Some(arg) => arg,

// Not all arguments need to be provided for instantiation,
Expand Down
12 changes: 6 additions & 6 deletions crates/environ/src/component/types_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,17 +325,17 @@ impl ComponentTypesBuilder {
let ty = &types[id];
let mut result = TypeComponent::default();
for (name, ty) in ty.imports.iter() {
self.register_abstract_component_entity_type(types, *ty);
self.register_abstract_component_entity_type(types, ty.ty);
result.imports.insert(
name.clone(),
self.convert_component_entity_type(types, *ty)?,
self.convert_component_entity_type(types, ty.ty)?,
);
}
for (name, ty) in ty.exports.iter() {
self.register_abstract_component_entity_type(types, *ty);
self.register_abstract_component_entity_type(types, ty.ty);
result.exports.insert(
name.clone(),
self.convert_component_entity_type(types, *ty)?,
self.convert_component_entity_type(types, ty.ty)?,
);
}
Ok(self.component_types.components.push(result))
Expand All @@ -350,10 +350,10 @@ impl ComponentTypesBuilder {
let ty = &types[id];
let mut result = TypeComponentInstance::default();
for (name, ty) in ty.exports.iter() {
self.register_abstract_component_entity_type(types, *ty);
self.register_abstract_component_entity_type(types, ty.ty);
result.exports.insert(
name.clone(),
self.convert_component_entity_type(types, *ty)?,
self.convert_component_entity_type(types, ty.ty)?,
);
}
Ok(self.component_types.component_instances.push(result))
Expand Down
2 changes: 1 addition & 1 deletion crates/environ/src/component/types_builder/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl ResourcesBuilder {
let ty = &types[id];
for (name, ty) in ty.exports.iter() {
path.push(name);
self.register_component_entity_type_(types, *ty, path, register);
self.register_component_entity_type_(types, ty.ty, path, register);
path.pop();
}
}
Expand Down
44 changes: 38 additions & 6 deletions crates/test-util/src/component_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,28 @@ pub enum LowerAbi {
Async,
}

impl LiftAbi {
fn is_async(self) -> bool {
!matches!(self, Self::Sync)
}

fn ensure_async(&mut self) {
if !self.is_async() {
*self = Self::AsyncStackful;
}
}
}

impl LowerAbi {
fn is_async(self) -> bool {
matches!(self, Self::Async)
}

fn ensure_async(&mut self) {
*self = Self::Async;
}
}

impl<'a> TestCase<'a> {
pub fn generate(types: &'a [Type], u: &mut Unstructured<'_>) -> arbitrary::Result<Self> {
let max_params = if types.len() > 0 { 5 } else { 0 };
Expand All @@ -1722,15 +1744,25 @@ impl<'a> TestCase<'a> {

let mut options = u.arbitrary::<TestCaseOptions>()?;

// Sync tasks cannot call async functions via a sync lower, nor can they
// block in other ways (e.g. by calling `waitable-set.wait`, returning
// `CALLBACK_CODE_WAIT`, etc.) prior to returning. Therefore,
// async-ness cascades to the callers:
if options.host_async {
// Keep each boundary self-consistent: async function types require async
// lowering/lifting, and async callees force their callers async too.
if options.host_async || options.callee_lower_abi.is_async() {
options.host_async = true;
options.callee_lower_abi.ensure_async();
options.guest_callee_async = true;
}
if options.guest_callee_async {
if options.guest_callee_async
|| options.callee_lift_abi.is_async()
|| options.caller_lower_abi.is_async()
{
options.guest_callee_async = true;
options.callee_lift_abi.ensure_async();
options.caller_lower_abi.ensure_async();
options.guest_caller_async = true;
}
if options.guest_caller_async || options.caller_lift_abi.is_async() {
options.guest_caller_async = true;
options.caller_lift_abi.ensure_async();
}

Ok(Self {
Expand Down
9 changes: 7 additions & 2 deletions crates/test-util/src/wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,14 @@ impl WastTest {
let unsupported = [
// These tests in the `component-model` submodule have not yet been
// updated to account for the recent threading-related intrinsic
// changes
"test/async/same-component-stream-future.wast",
// changes.
"test/async/trap-if-block-and-sync.wast",
// Wasmtime doesn't expose the component-model `cm64` feature toggle
// yet, so this parser-only test can't be enabled here.
"test/wasm-tools/memory64.wast",
// Cancellable `thread.yield` semantics still diverge from the
// latest submodule expectation.
"test/async/cancellable.wast",
];
if unsupported.iter().any(|part| self.path.ends_with(part)) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ impl<'a> CodeBuilder<'a> {
// unfortunately the `wasm-compose` API is not powerful
// enough for us to do all that.
ensure!(
imp.name.0 != intrinsics_import,
imp.name.name != intrinsics_import,
"main Wasm cannot import the unsafe intrinsics (`{intrinsics_import}`) \
when using compile-time builtins"
);

if let wasmparser::ComponentTypeRef::Instance(_) = imp.ty {
instance_imports.insert(imp.name.0);
instance_imports.insert(imp.name.name);
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion crates/wast/src/spectest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ pub fn link_component_spectest<T>(linker: &mut component::Linker<T>) -> Result<(
let engine = linker.engine().clone();
linker
.root()
.func_wrap("host-echo-u32", |_, v: (u32,)| Ok(v))?;
.func_wrap_concurrent("host-echo-u32", |_, (v,): (u32,)| {
Box::pin(async move { Ok((v,)) })
})?;
linker
.root()
.func_wrap("host-return-two", |_, _: ()| Ok((2u32,)))?;
Expand Down
2 changes: 1 addition & 1 deletion crates/wizer/src/component/rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl ReencodeComponent for Reencoder<'_> {
) -> Result<(), Error> {
for export in section {
let export = export?;
if !self.wizer.get_keep_init_func() && export.name.0 == self.wizer.get_init_func() {
if !self.wizer.get_keep_init_func() && export.name.name == self.wizer.get_init_func() {
self.removed_func = Some(self.funcs);
} else {
if export.kind == wasmparser::ComponentExternalKind::Func {
Expand Down
2 changes: 1 addition & 1 deletion crates/wizer/tests/all/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ async fn export_is_removed() -> Result<()> {
wasmparser::Payload::ComponentExportSection(s) => Some(s),
_ => None,
})
.flat_map(|section| section.into_iter().map(|e| e.unwrap().name.0))
.flat_map(|section| section.into_iter().map(|e| e.unwrap().name.name))
.collect()
}
}
Expand Down
44 changes: 22 additions & 22 deletions supply-chain/imports.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,8 @@ user-login = "alexcrichton"
user-name = "Alex Crichton"

[[publisher.json-from-wast]]
version = "0.248.0"
when = "2026-04-28"
version = "0.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.libc]]
Expand Down Expand Up @@ -1500,8 +1500,8 @@ user-login = "alexcrichton"
user-name = "Alex Crichton"

[[publisher.wasm-compose]]
version = "0.248.0"
when = "2026-04-28"
version = "0.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-encoder]]
Expand All @@ -1515,8 +1515,8 @@ when = "2026-04-17"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-encoder]]
version = "0.248.0"
when = "2026-04-28"
version = "0.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-metadata]]
Expand All @@ -1531,13 +1531,13 @@ when = "2026-04-17"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-metadata]]
version = "0.248.0"
when = "2026-04-28"
version = "0.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-wave]]
version = "0.248.0"
when = "2026-04-28"
version = "0.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasmparser]]
Expand All @@ -1551,13 +1551,13 @@ when = "2026-04-17"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasmparser]]
version = "0.248.0"
when = "2026-04-28"
version = "0.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasmprinter]]
version = "0.248.0"
when = "2026-04-28"
version = "0.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasmtime]]
Expand Down Expand Up @@ -1716,13 +1716,13 @@ when = "2026-04-30"
trusted-publisher = "github:bytecodealliance/wasmtime"

[[publisher.wast]]
version = "248.0.0"
when = "2026-04-28"
version = "249.0.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wat]]
version = "1.248.0"
when = "2026-04-28"
version = "1.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wiggle]]
Expand Down Expand Up @@ -2011,8 +2011,8 @@ when = "2026-04-17"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wit-component]]
version = "0.248.0"
when = "2026-04-28"
version = "0.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wit-parser]]
Expand All @@ -2026,8 +2026,8 @@ when = "2026-04-17"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wit-parser]]
version = "0.248.0"
when = "2026-04-28"
version = "0.249.0"
when = "2026-05-15"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.witx]]
Expand Down
Loading
Loading