A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Update wasm-tools dependencies to 253 (#13834)
Alex Crichton973fa24c3e8d
diff --git a/Cargo.lock b/Cargo.lockindex f72ae2fcce..9853ecee56 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -609,7 +609,7 @@ dependencies = ["test-programs-artifacts","tokio","wasm-compose",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmtime","wasmtime-wasi",]@@ -2237,14 +2237,14 @@ dependencies = [[[package]]name = "json-from-wast"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "49773501e81857d7655a7f813903904ba639229129b6a37774d505c00beb2408"+checksum = "85e0660a87ff1378828bc1b1466f44a3269470c7f25d4c5da7fa7bcddc5849ad"dependencies = ["anyhow","serde","serde_derive",- "wast 252.0.0",+ "wast 253.0.0",][[package]]@@ -3804,7 +3804,7 @@ dependencies = ["wasmtime","wasmtime-test-util","wat",- "wit-component 0.252.0",+ "wit-component 0.253.0",][[package]]@@ -4258,7 +4258,7 @@ name = "verify-component-adapter"version = "48.0.0"dependencies = ["anyhow",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wat",]@@ -4335,7 +4335,7 @@ dependencies = ["byte-array-literals","object 0.39.0","wasip1",- "wasm-encoder 0.252.0",+ "wasm-encoder 0.253.0","wit-bindgen-rust-macro 0.58.0",]@@ -4365,9 +4365,9 @@ dependencies = [[[package]]name = "wasm-compose"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d59b710751a35d54732a63851cdfacbfb2266b7160ce174faf269d3f4e84e31b"+checksum = "a00572a13a43b4754066ddeb46aec65091cd4cdb5b632768295a4236574da28a"dependencies = ["anyhow","heck",@@ -4375,8 +4375,8 @@ dependencies = ["log","petgraph","smallvec 1.15.1",- "wasm-encoder 0.252.0",- "wasmparser 0.252.0",+ "wasm-encoder 0.253.0",+ "wasmparser 0.253.0","wat",]@@ -4402,12 +4402,12 @@ dependencies = [[[package]]name = "wasm-encoder"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8185ae345fa5687c054626ff9a50e7089797a343d9904d1dc9820eb4c4d3196f"+checksum = "59972d6cd272259de647b7c1f1912e45e289c75ffd4be04e10695507cd7e1b59"dependencies = ["leb128fmt",- "wasmparser 0.252.0",+ "wasmparser 0.253.0",][[package]]@@ -4436,42 +4436,42 @@ dependencies = [[[package]]name = "wasm-metadata"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2b7e08e02a3cd55bf778009d4cd6faae50da011f293644daf78a531a32d6d142"+checksum = "b3f45816ef616806f48498bcd831377de578c4fa51db0c83ab8ceb78cc13523b"dependencies = ["anyhow","indexmap 2.14.0",- "wasm-encoder 0.252.0",- "wasmparser 0.252.0",+ "wasm-encoder 0.253.0",+ "wasmparser 0.253.0",][[package]]name = "wasm-mutate"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8985d0801fa833449c52e91fd2f9ebfab12ba929893b469da187fe9c36907f0d"+checksum = "5111322c954d3980d87b1f36dbf4dc2360e049e087193f89628ca2af30dab7c6"dependencies = ["egg","log","rand 0.10.1","thiserror 2.0.17",- "wasm-encoder 0.252.0",- "wasmparser 0.252.0",+ "wasm-encoder 0.253.0",+ "wasmparser 0.253.0",][[package]]name = "wasm-smith"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dfd41f3236c30bd597009c43c15751dcc4c467724aef84141706a736f1ea5081"+checksum = "e7335822038378faf4d602be116692189ff5bd37b3b3353639c4e18450fa56ce"dependencies = ["anyhow","arbitrary","flagset","serde","serde_derive",- "wasm-encoder 0.252.0",+ "wasm-encoder 0.253.0","wat",]@@ -4485,14 +4485,14 @@ dependencies = [[[package]]name = "wasm-wave"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "054d19e2b53e3bf158deac6e8cc003d9eaf3ec7ecaef579988ef7b5c666f9546"+checksum = "ccf5d5caa1d6dc81bb26518198e7c3d6b78a944284cb612b3f4b27fa8132eec7"dependencies = ["anyhow","logos","thiserror 2.0.17",- "wit-parser 0.252.0",+ "wit-parser 0.253.0",][[package]]@@ -4571,9 +4571,9 @@ dependencies = [[[package]]name = "wasmparser"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d3eb099dcadcde5be9eef55e3a337128efd4e44b4c93122487e4d2e4e1c6627c"+checksum = "19db11f87d2486580e1e8b6f494c54df7e0566b87d0b599db843c24019667339"dependencies = ["bitflags 2.11.1","hashbrown 0.17.0",@@ -4584,13 +4584,13 @@ dependencies = [[[package]]name = "wasmprinter"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7142797de29b35ab8dbf15c00f55fda75d409da4c423a8ab8bd6b667a785824b"+checksum = "cafccdb2ba2cffd9c4f96b88a9710651d63266e858d54be262a141b528b26dac"dependencies = ["anyhow","termcolor",- "wasmparser 0.252.0",+ "wasmparser 0.253.0",][[package]]@@ -4633,9 +4633,9 @@ dependencies = ["tempfile","tokio","wasm-compose",- "wasm-encoder 0.252.0",+ "wasm-encoder 0.253.0","wasm-wave",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmtime-environ","wasmtime-internal-cache","wasmtime-internal-component-macro",@@ -4652,7 +4652,7 @@ dependencies = ["wasmtime-test-util","wat","windows-sys 0.61.2",- "wit-parser 0.252.0",+ "wit-parser 0.253.0",][[package]]@@ -4746,8 +4746,8 @@ dependencies = ["toml","tracing","walkdir",- "wasm-encoder 0.252.0",- "wasmparser 0.252.0",+ "wasm-encoder 0.253.0",+ "wasmparser 0.253.0","wasmprinter","wasmtime","wasmtime-cli-flags",@@ -4769,10 +4769,10 @@ dependencies = ["wasmtime-wasi-tls","wasmtime-wast","wasmtime-wizer",- "wast 252.0.0",+ "wast 253.0.0","wat","windows-sys 0.61.2",- "wit-component 0.252.0",+ "wit-component 0.253.0",][[package]]@@ -4815,8 +4815,8 @@ dependencies = ["sha2","smallvec 1.15.1","target-lexicon",- "wasm-encoder 0.252.0",- "wasmparser 0.252.0",+ "wasm-encoder 0.253.0",+ "wasmparser 0.253.0","wasmprinter","wasmtime-internal-component-util","wasmtime-internal-core",@@ -4830,7 +4830,7 @@ dependencies = ["arbitrary","env_logger 0.11.5","libfuzzer-sys",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmprinter","wasmtime-environ","wasmtime-test-util",@@ -4862,7 +4862,7 @@ dependencies = ["rand 0.10.1","smallvec 1.15.1","target-lexicon",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmtime","wasmtime-fuzzing","wasmtime-internal-core",@@ -4890,12 +4890,12 @@ dependencies = ["tempfile","tokio","v8",- "wasm-encoder 0.252.0",+ "wasm-encoder 0.253.0","wasm-mutate","wasm-smith","wasm-spec-interpreter","wasmi",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmprinter","wasmtime","wasmtime-cli-flags",@@ -4952,7 +4952,7 @@ dependencies = ["wasmtime","wasmtime-internal-component-util","wasmtime-internal-wit-bindgen",- "wit-parser 0.252.0",+ "wit-parser 0.253.0",][[package]]@@ -4987,7 +4987,7 @@ dependencies = ["smallvec 1.15.1","target-lexicon","thiserror 2.0.17",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmtime-environ","wasmtime-internal-core","wasmtime-internal-unwinder",@@ -5104,7 +5104,7 @@ dependencies = ["log","object 0.39.0","target-lexicon",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmtime-environ","wasmtime-internal-cranelift","winch-codegen",@@ -5118,7 +5118,7 @@ dependencies = ["bitflags 2.11.1","heck","indexmap 2.14.0",- "wit-parser 0.252.0",+ "wit-parser 0.253.0",][[package]]@@ -5151,7 +5151,7 @@ dependencies = ["serde_derive","target-lexicon","toml",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmprinter","wasmtime","wasmtime-environ",@@ -5303,9 +5303,9 @@ dependencies = ["object 0.39.0","serde_json","tokio",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmtime",- "wast 252.0.0",+ "wast 253.0.0",][[package]]@@ -5319,8 +5319,8 @@ dependencies = ["rayon","test-programs-artifacts","tokio",- "wasm-encoder 0.252.0",- "wasmparser 0.252.0",+ "wasm-encoder 0.253.0",+ "wasmparser 0.253.0","wasmprinter","wasmtime","wasmtime-wasi",@@ -5338,25 +5338,25 @@ dependencies = [[[package]]name = "wast"-version = "252.0.0"+version = "253.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "942a3449d6a593fccc111a6241c8df52bda168af30e40bf9580d4394d7374c65"+checksum = "d3264542f8965c5d84fb1085d924bfba9a6314bb228eff13a2de14d7627664d0"dependencies = ["bumpalo","gimli 0.32.3","leb128fmt","memchr","unicode-width 0.2.0",- "wasm-encoder 0.252.0",+ "wasm-encoder 0.253.0",][[package]]name = "wat"-version = "1.252.0"+version = "1.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c72a4ba7088f7bac94cf516e49882bdf97068904a563768cf249efc839ec42cb"+checksum = "4bfc5ce906144200c972ec617470aa35bd847472e170b26dde3e80541c674055"dependencies = [- "wast 252.0.0",+ "wast 253.0.0",][[package]]@@ -5483,7 +5483,7 @@ dependencies = ["smallvec 1.15.1","target-lexicon","thiserror 2.0.17",- "wasmparser 0.252.0",+ "wasmparser 0.253.0","wasmtime-environ","wasmtime-internal-core","wasmtime-internal-cranelift",@@ -5805,9 +5805,9 @@ dependencies = [[[package]]name = "wit-component"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "76db0662b590f45d33d0e363fa13539a5a1eecd35d5a12fe208c335461c1053d"+checksum = "dbbd2500ac3488489ee8c6e59b79d7e47e6da5bfb019efd35d5dca57b78af624"dependencies = ["anyhow","bitflags 2.11.1",@@ -5816,10 +5816,10 @@ dependencies = ["serde","serde_derive","serde_json",- "wasm-encoder 0.252.0",- "wasm-metadata 0.252.0",- "wasmparser 0.252.0",- "wit-parser 0.252.0",+ "wasm-encoder 0.253.0",+ "wasm-metadata 0.253.0",+ "wasmparser 0.253.0",+ "wit-parser 0.253.0",][[package]]@@ -5861,9 +5861,9 @@ dependencies = [[[package]]name = "wit-parser"-version = "0.252.0"+version = "0.253.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4266bea110371c620ccf3201c5023676046bc4556e5c7cfb5d500bda5ebc162d"+checksum = "4d997b8e5920fcbeec742b58e583325d6419a6aca617ae8075c406a61c65ba8a"dependencies = ["anyhow","hashbrown 0.17.0",@@ -5875,7 +5875,7 @@ dependencies = ["serde_derive","serde_json","unicode-ident",- "wasmparser 0.252.0",+ "wasmparser 0.253.0",][[package]]diff --git a/Cargo.toml b/Cargo.tomlindex 41d0025ba3..b88f02bbce 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -358,18 +358,18 @@ wit-bindgen = { version = "0.58.0", default-features = false }wit-bindgen-rust-macro = { version = "0.58.0", default-features = false }# wasm-tools family:-wasmparser = { version = "0.252.0", default-features = false, features = ['simd'] }-wat = "1.252.0"-wast = "252.0.0"-wasmprinter = "0.252.0"-wasm-encoder = "0.252.0"-wasm-smith = "0.252.0"-wasm-mutate = "0.252.0"-wit-parser = "0.252.0"-wit-component = "0.252.0"-wasm-wave = "0.252.0"-wasm-compose = { version = "0.252.0", default-features = false }-json-from-wast = "0.252.0"+wasmparser = { version = "0.253.0", default-features = false, features = ['simd'] }+wat = "1.253.0"+wast = "253.0.0"+wasmprinter = "0.253.0"+wasm-encoder = "0.253.0"+wasm-smith = "0.253.0"+wasm-mutate = "0.253.0"+wit-parser = "0.253.0"+wit-component = "0.253.0"+wasm-wave = "0.253.0"+wasm-compose = { version = "0.253.0", default-features = false }+json-from-wast = "0.253.0"wstd = "0.6.5"wasip2 = "1.0"diff --git a/crates/component-macro/src/bindgen.rs b/crates/component-macro/src/bindgen.rsindex fa9ec3d8e7..4cdf0afe84 100644--- a/crates/component-macro/src/bindgen.rs+++ b/crates/component-macro/src/bindgen.rs@@ -10,7 +10,7 @@ use syn::{Token, braced, token};use wasmtime_wit_bindgen::{FunctionConfig, FunctionFilter, FunctionFlags, Opts, Ownership, TrappableError,};-use wit_parser::{PackageId, Resolve, UnresolvedPackageGroup, WorldId};+use wit_parser::{PackageId, Resolve, WorldId};pub struct Config {opts: Opts,@@ -237,7 +237,7 @@ fn parse_source(if let Some(inline) = inline {pkgs.truncate(0);- pkgs.push(resolve.push_group(UnresolvedPackageGroup::parse("macro-input", inline)?)?);+ pkgs.push(resolve.push_str("macro-input", inline)?);}Ok((resolve, pkgs, files))diff --git a/crates/cranelift/src/compiler/component.rs b/crates/cranelift/src/compiler/component.rsindex 4bbd47ec83..265388be81 100644--- a/crates/cranelift/src/compiler/component.rs+++ b/crates/cranelift/src/compiler/component.rs@@ -297,24 +297,6 @@ impl<'a> TrampolineCompiler<'a> {},);}- Trampoline::ThreadYield {- instance,- cancellable,- } => {- self.translate_libcall(- host::thread_yield,- TrapSentinel::NegativeOne,- WasmArgs::InRegisters,- |me, params| {- params.push(me.index_value(*instance));- params.push(- me.builder- .ins()- .iconst(ir::types::I8, i64::from(*cancellable)),- );- },- );- }Trampoline::SubtaskDrop { instance } => {self.translate_libcall(host::subtask_drop,@@ -755,12 +737,40 @@ impl<'a> TrampolineCompiler<'a> {},);}- Trampoline::ThreadSuspendToSuspended {+ Trampoline::ThreadResumeLater { instance } => {+ self.translate_libcall(+ host::thread_resume_later,+ TrapSentinel::Falsy,+ WasmArgs::InRegisters,+ |me, params| {+ params.push(me.index_value(*instance));+ },+ );+ }+ Trampoline::ThreadSuspend {+ instance,+ cancellable,+ } => {+ self.translate_libcall(+ host::thread_suspend,+ TrapSentinel::NegativeOne,+ WasmArgs::InRegisters,+ |me, params| {+ params.push(me.index_value(*instance));+ params.push(+ me.builder+ .ins()+ .iconst(ir::types::I8, i64::from(*cancellable)),+ );+ },+ );+ }+ Trampoline::ThreadYield {instance,cancellable,} => {self.translate_libcall(- host::thread_suspend_to_suspended,+ host::thread_yield,TrapSentinel::NegativeOne,WasmArgs::InRegisters,|me, params| {@@ -773,12 +783,12 @@ impl<'a> TrampolineCompiler<'a> {},);}- Trampoline::ThreadSuspendTo {+ Trampoline::ThreadSuspendThenResume {instance,cancellable,} => {self.translate_libcall(- host::thread_suspend_to,+ host::thread_suspend_then_resume,TrapSentinel::NegativeOne,WasmArgs::InRegisters,|me, params| {@@ -791,12 +801,12 @@ impl<'a> TrampolineCompiler<'a> {},);}- Trampoline::ThreadSuspend {+ Trampoline::ThreadYieldThenResume {instance,cancellable,} => {self.translate_libcall(- host::thread_suspend,+ host::thread_yield_then_resume,TrapSentinel::NegativeOne,WasmArgs::InRegisters,|me, params| {@@ -809,22 +819,30 @@ impl<'a> TrampolineCompiler<'a> {},);}- Trampoline::ThreadUnsuspend { instance } => {+ Trampoline::ThreadSuspendThenPromote {+ instance,+ cancellable,+ } => {self.translate_libcall(- host::thread_unsuspend,- TrapSentinel::Falsy,+ host::thread_suspend_then_promote,+ TrapSentinel::NegativeOne,WasmArgs::InRegisters,|me, params| {params.push(me.index_value(*instance));+ params.push(+ me.builder+ .ins()+ .iconst(ir::types::I8, i64::from(*cancellable)),+ );},);}- Trampoline::ThreadYieldToSuspended {+ Trampoline::ThreadYieldThenPromote {instance,cancellable,} => {self.translate_libcall(- host::thread_yield_to_suspended,+ host::thread_yield_then_promote,TrapSentinel::NegativeOne,WasmArgs::InRegisters,|me, params| {@@ -1490,13 +1508,14 @@ impl<'a> TrampolineCompiler<'a> {| Trampoline::WaitableSetPoll { instance, .. }| Trampoline::WaitableSetDrop { instance }| Trampoline::WaitableJoin { instance }- | Trampoline::ThreadYield { instance, .. }| Trampoline::ThreadNewIndirect { instance, .. }+ | Trampoline::ThreadResumeLater { instance, .. }| Trampoline::ThreadSuspend { instance, .. }- | Trampoline::ThreadSuspendToSuspended { instance, .. }- | Trampoline::ThreadSuspendTo { instance, .. }- | Trampoline::ThreadUnsuspend { instance, .. }- | Trampoline::ThreadYieldToSuspended { instance, .. }+ | Trampoline::ThreadYield { instance, .. }+ | Trampoline::ThreadSuspendThenResume { instance, .. }+ | Trampoline::ThreadYieldThenResume { instance, .. }+ | Trampoline::ThreadSuspendThenPromote { instance, .. }+ | Trampoline::ThreadYieldThenPromote { instance, .. }| Trampoline::SubtaskDrop { instance }| Trampoline::SubtaskCancel { instance, .. }| Trampoline::ErrorContextNew { instance, .. }diff --git a/crates/environ/src/component.rs b/crates/environ/src/component.rsindex 063ec8edb8..3f78867781 100644--- a/crates/environ/src/component.rs+++ b/crates/environ/src/component.rs@@ -117,8 +117,6 @@ macro_rules! foreach_builtin_component_function {#[cfg(feature = "component-model-async")]waitable_join(vmctx: vmctx, caller_instance: u32, set: u32, waitable: u32) -> bool;#[cfg(feature = "component-model-async")]- thread_yield(vmctx: vmctx, caller_instance: u32, cancellable: u8) -> u32;- #[cfg(feature = "component-model-async")]subtask_drop(vmctx: vmctx, caller_instance: u32, task_id: u32) -> bool;#[cfg(feature = "component-model-async")]subtask_cancel(vmctx: vmctx, caller_instance: u32, async_: u8, task_id: u32) -> u64;@@ -190,15 +188,19 @@ macro_rules! foreach_builtin_component_function {#[cfg(feature = "component-model-async")]thread_new_indirect(vmctx: vmctx, caller_instance: u32, func_ty_id: u32, func_table_idx: u32, func_idx: u32, context: u32) -> u64;#[cfg(feature = "component-model-async")]- thread_suspend_to_suspended(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;- #[cfg(feature = "component-model-async")]- thread_suspend_to(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;+ thread_resume_later(vmctx: vmctx, caller_instance: u32, thread_idx: u32) -> bool;#[cfg(feature = "component-model-async")]thread_suspend(vmctx: vmctx, caller_instance: u32, cancellable: u8) -> u32;#[cfg(feature = "component-model-async")]- thread_unsuspend(vmctx: vmctx, caller_instance: u32, thread_idx: u32) -> bool;+ thread_yield(vmctx: vmctx, caller_instance: u32, cancellable: u8) -> u32;+ #[cfg(feature = "component-model-async")]+ thread_suspend_then_resume(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;+ #[cfg(feature = "component-model-async")]+ thread_yield_then_resume(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;+ #[cfg(feature = "component-model-async")]+ thread_suspend_then_promote(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;#[cfg(feature = "component-model-async")]- thread_yield_to_suspended(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;+ thread_yield_then_promote(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;trap(vmctx: vmctx, code: u32) -> bool;diff --git a/crates/environ/src/component/dfg.rs b/crates/environ/src/component/dfg.rsindex 4f604dda09..23bf095dff 100644--- a/crates/environ/src/component/dfg.rs+++ b/crates/environ/src/component/dfg.rs@@ -369,10 +369,6 @@ pub enum Trampoline {WaitableJoin {instance: RuntimeComponentInstanceIndex,},- ThreadYield {- instance: RuntimeComponentInstanceIndex,- cancellable: bool,- },SubtaskDrop {instance: RuntimeComponentInstanceIndex,},@@ -482,22 +478,30 @@ pub enum Trampoline {start_func_ty_idx: ComponentTypeIndex,start_func_table_id: TableId,},- ThreadSuspendToSuspended {+ ThreadResumeLater {instance: RuntimeComponentInstanceIndex,- cancellable: bool,},ThreadSuspend {instance: RuntimeComponentInstanceIndex,cancellable: bool,},- ThreadSuspendTo {+ ThreadYield {+ instance: RuntimeComponentInstanceIndex,+ cancellable: bool,+ },+ ThreadSuspendThenResume {instance: RuntimeComponentInstanceIndex,cancellable: bool,},- ThreadUnsuspend {+ ThreadYieldThenResume {instance: RuntimeComponentInstanceIndex,+ cancellable: bool,},- ThreadYieldToSuspended {+ ThreadSuspendThenPromote {+ instance: RuntimeComponentInstanceIndex,+ cancellable: bool,+ },+ ThreadYieldThenPromote {instance: RuntimeComponentInstanceIndex,cancellable: bool,},@@ -998,13 +1002,6 @@ impl LinearizeDfg<'_> {Trampoline::WaitableJoin { instance } => info::Trampoline::WaitableJoin {instance: *instance,},- Trampoline::ThreadYield {- instance,- cancellable,- } => info::Trampoline::ThreadYield {- instance: *instance,- cancellable: *cancellable,- },Trampoline::SubtaskDrop { instance } => info::Trampoline::SubtaskDrop {instance: *instance,},@@ -1169,34 +1166,48 @@ impl LinearizeDfg<'_> {start_func_ty_idx: *start_func_ty_idx,start_func_table_idx: self.runtime_table(*start_func_table_id),},- Trampoline::ThreadSuspendToSuspended {+ Trampoline::ThreadResumeLater { instance } => info::Trampoline::ThreadResumeLater {+ instance: *instance,+ },+ Trampoline::ThreadSuspend {instance,cancellable,- } => info::Trampoline::ThreadSuspendToSuspended {+ } => info::Trampoline::ThreadSuspend {instance: *instance,cancellable: *cancellable,},- Trampoline::ThreadSuspendTo {+ Trampoline::ThreadYield {instance,cancellable,- } => info::Trampoline::ThreadSuspendTo {+ } => info::Trampoline::ThreadYield {instance: *instance,cancellable: *cancellable,},- Trampoline::ThreadSuspend {+ Trampoline::ThreadSuspendThenResume {instance,cancellable,- } => info::Trampoline::ThreadSuspend {+ } => info::Trampoline::ThreadSuspendThenResume {instance: *instance,cancellable: *cancellable,},- Trampoline::ThreadUnsuspend { instance } => info::Trampoline::ThreadUnsuspend {+ Trampoline::ThreadYieldThenResume {+ instance,+ cancellable,+ } => info::Trampoline::ThreadYieldThenResume {instance: *instance,+ cancellable: *cancellable,+ },+ Trampoline::ThreadSuspendThenPromote {+ instance,+ cancellable,+ } => info::Trampoline::ThreadSuspendThenPromote {+ instance: *instance,+ cancellable: *cancellable,},- Trampoline::ThreadYieldToSuspended {+ Trampoline::ThreadYieldThenPromote {instance,cancellable,- } => info::Trampoline::ThreadYieldToSuspended {+ } => info::Trampoline::ThreadYieldThenPromote {instance: *instance,cancellable: *cancellable,},diff --git a/crates/environ/src/component/info.rs b/crates/environ/src/component/info.rsindex ad8850f481..e839f1d6e7 100644--- a/crates/environ/src/component/info.rs+++ b/crates/environ/src/component/info.rs@@ -841,16 +841,6 @@ pub enum Trampoline {instance: RuntimeComponentInstanceIndex,},- /// A `thread.yield` intrinsic, which yields control to the host so that other- /// tasks are able to make progress, if any.- ThreadYield {- /// The specific component instance which is calling the intrinsic.- instance: RuntimeComponentInstanceIndex,- /// If `true`, indicates the caller instance may receive notification- /// of task cancellation.- cancellable: bool,- },-/// A `subtask.drop` intrinsic to drop a specified task which has completed.SubtaskDrop {/// The specific component instance which is calling the intrinsic.@@ -1131,8 +1121,15 @@ pub enum Trampoline {start_func_table_idx: RuntimeTableIndex,},- /// Intrinsic used to implement the `thread.suspend-to-suspended` component model builtin.- ThreadSuspendToSuspended {+ /// Intrinsic used to implement the `thread.resume-later` component model+ /// builtin.+ ThreadResumeLater {+ /// The specific component instance which is calling the intrinsic.+ instance: RuntimeComponentInstanceIndex,+ },++ /// Intrinsic used to implement the `thread.suspend` component model builtin.+ ThreadSuspend {/// The specific component instance which is calling the intrinsic.instance: RuntimeComponentInstanceIndex,/// If `true`, indicates the caller instance may receive notification@@ -1140,8 +1137,9 @@ pub enum Trampoline {cancellable: bool,},- /// Intrinsic used to implement the `thread.suspend-to` component model builtin.- ThreadSuspendTo {+ /// A `thread.yield` intrinsic, which yields control to the host so that other+ /// tasks are able to make progress, if any.+ ThreadYield {/// The specific component instance which is calling the intrinsic.instance: RuntimeComponentInstanceIndex,/// If `true`, indicates the caller instance may receive notification@@ -1149,8 +1147,19 @@ pub enum Trampoline {cancellable: bool,},- /// Intrinsic used to implement the `thread.suspend` component model builtin.- ThreadSuspend {+ /// Intrinsic used to implement the `thread.suspend-then-resume` component+ /// model builtin.+ ThreadSuspendThenResume {+ /// The specific component instance which is calling the intrinsic.+ instance: RuntimeComponentInstanceIndex,+ /// If `true`, indicates the caller instance may receive notification+ /// of task cancellation.+ cancellable: bool,+ },++ /// Intrinsic used to implement the `thread.yield-then-resume` component+ /// model builtin.+ ThreadYieldThenResume {/// The specific component instance which is calling the intrinsic.instance: RuntimeComponentInstanceIndex,/// If `true`, indicates the caller instance may receive notification@@ -1158,14 +1167,19 @@ pub enum Trampoline {cancellable: bool,},- /// Intrinsic used to implement the `thread.unsuspend` component model builtin.- ThreadUnsuspend {+ /// Intrinsic used to implement the `thread.suspend-then-promote` component+ /// model builtin.+ ThreadSuspendThenPromote {/// The specific component instance which is calling the intrinsic.instance: RuntimeComponentInstanceIndex,+ /// If `true`, indicates the caller instance may receive notification+ /// of task cancellation.+ cancellable: bool,},- /// Intrinsic used to implement the `thread.yield-to-suspended` component model builtin.- ThreadYieldToSuspended {+ /// Intrinsic used to implement the `thread.yield-then-promote` component+ /// model builtin.+ ThreadYieldThenPromote {/// The specific component instance which is calling the intrinsic.instance: RuntimeComponentInstanceIndex,/// If `true`, indicates the caller instance may receive notification@@ -1203,7 +1217,6 @@ impl Trampoline {WaitableSetPoll { .. } => format!("waitable-set-poll"),WaitableSetDrop { .. } => format!("waitable-set-drop"),WaitableJoin { .. } => format!("waitable-join"),- ThreadYield { .. } => format!("thread-yield"),SubtaskDrop { .. } => format!("subtask-drop"),SubtaskCancel { .. } => format!("subtask-cancel"),StreamNew { .. } => format!("stream-new"),@@ -1236,11 +1249,13 @@ impl Trampoline {ExitSyncCall => format!("exit-sync-call"),ThreadIndex => format!("thread-index"),ThreadNewIndirect { .. } => format!("thread-new-indirect"),- ThreadSuspendToSuspended { .. } => format!("thread-suspend-to-suspended"),- ThreadSuspendTo { .. } => format!("thread-suspend-to"),+ ThreadResumeLater { .. } => format!("thread-resume-later"),ThreadSuspend { .. } => format!("thread-suspend"),- ThreadUnsuspend { .. } => format!("thread-unsuspend"),- ThreadYieldToSuspended { .. } => format!("thread-yield-to-suspended"),+ ThreadYield { .. } => format!("thread-yield"),+ ThreadSuspendThenResume { .. } => format!("thread-suspend-then-resume"),+ ThreadYieldThenResume { .. } => format!("thread-yield-then-resume"),+ ThreadSuspendThenPromote { .. } => format!("thread-suspend-then-promote"),+ ThreadYieldThenPromote { .. } => format!("thread-yield-then-promote"),}}}diff --git a/crates/environ/src/component/translate.rs b/crates/environ/src/component/translate.rsindex edd81b72a3..c4d7ed007e 100644--- a/crates/environ/src/component/translate.rs+++ b/crates/environ/src/component/translate.rs@@ -223,10 +223,6 @@ enum LocalInitializer<'data> {WaitableJoin {func: ModuleInternedTypeIndex,},- ThreadYield {- func: ModuleInternedTypeIndex,- cancellable: bool,- },SubtaskDrop {func: ModuleInternedTypeIndex,},@@ -319,22 +315,30 @@ enum LocalInitializer<'data> {start_func_ty: ComponentTypeIndex,start_func_table_index: TableIndex,},- ThreadSuspendToSuspended {+ ThreadResumeLater {func: ModuleInternedTypeIndex,- cancellable: bool,},ThreadSuspend {func: ModuleInternedTypeIndex,cancellable: bool,},- ThreadSuspendTo {+ ThreadYield {+ func: ModuleInternedTypeIndex,+ cancellable: bool,+ },+ ThreadSuspendThenResume {func: ModuleInternedTypeIndex,cancellable: bool,},- ThreadUnsuspend {+ ThreadYieldThenResume {func: ModuleInternedTypeIndex,+ cancellable: bool,},- ThreadYieldToSuspended {+ ThreadSuspendThenPromote {+ func: ModuleInternedTypeIndex,+ cancellable: bool,+ },+ ThreadYieldThenPromote {func: ModuleInternedTypeIndex,cancellable: bool,},@@ -861,10 +865,6 @@ impl<'a, 'data> Translator<'a, 'data> {core_func_index += 1;LocalInitializer::ResourceDrop(resource, ty)}- wasmparser::CanonicalFunction::ResourceDropAsync { resource } => {- let _ = resource;- bail!("support for `resource.drop async` not implemented yet")- }wasmparser::CanonicalFunction::ResourceRep { resource } => {let resource = self.validator@@ -970,11 +970,6 @@ impl<'a, 'data> Translator<'a, 'data> {core_func_index += 1;LocalInitializer::WaitableJoin { func }}- wasmparser::CanonicalFunction::ThreadYield { cancellable } => {- let func = self.core_func_signature(core_func_index)?;- core_func_index += 1;- LocalInitializer::ThreadYield { func, cancellable }- }wasmparser::CanonicalFunction::SubtaskDrop => {let func = self.core_func_signature(core_func_index)?;core_func_index += 1;@@ -1173,30 +1168,40 @@ impl<'a, 'data> Translator<'a, 'data> {start_func_table_index: TableIndex::from_u32(table_index),}}- wasmparser::CanonicalFunction::ThreadSuspendToSuspended { cancellable } => {+ wasmparser::CanonicalFunction::ThreadResumeLater => {let func = self.core_func_signature(core_func_index)?;core_func_index += 1;- LocalInitializer::ThreadSuspendToSuspended { func, cancellable }+ LocalInitializer::ThreadResumeLater { func }}wasmparser::CanonicalFunction::ThreadSuspend { cancellable } => {let func = self.core_func_signature(core_func_index)?;core_func_index += 1;LocalInitializer::ThreadSuspend { func, cancellable }}- wasmparser::CanonicalFunction::ThreadSuspendTo { cancellable } => {+ wasmparser::CanonicalFunction::ThreadYield { cancellable } => {+ let func = self.core_func_signature(core_func_index)?;+ core_func_index += 1;+ LocalInitializer::ThreadYield { func, cancellable }+ }+ wasmparser::CanonicalFunction::ThreadSuspendThenResume { cancellable } => {+ let func = self.core_func_signature(core_func_index)?;+ core_func_index += 1;+ LocalInitializer::ThreadSuspendThenResume { func, cancellable }+ }+ wasmparser::CanonicalFunction::ThreadYieldThenResume { cancellable } => {let func = self.core_func_signature(core_func_index)?;core_func_index += 1;- LocalInitializer::ThreadSuspendTo { func, cancellable }+ LocalInitializer::ThreadYieldThenResume { func, cancellable }}- wasmparser::CanonicalFunction::ThreadUnsuspend => {+ wasmparser::CanonicalFunction::ThreadSuspendThenPromote { cancellable } => {let func = self.core_func_signature(core_func_index)?;core_func_index += 1;- LocalInitializer::ThreadUnsuspend { func }+ LocalInitializer::ThreadSuspendThenPromote { func, cancellable }}- wasmparser::CanonicalFunction::ThreadYieldToSuspended { cancellable } => {+ wasmparser::CanonicalFunction::ThreadYieldThenPromote { cancellable } => {let func = self.core_func_signature(core_func_index)?;core_func_index += 1;- LocalInitializer::ThreadYieldToSuspended { func, cancellable }+ LocalInitializer::ThreadYieldThenPromote { func, cancellable }}};self.result.initializers.push(init);diff --git a/crates/environ/src/component/translate/inline.rs b/crates/environ/src/component/translate/inline.rsindex a4916df832..7cada0b9c4 100644--- a/crates/environ/src/component/translate/inline.rs+++ b/crates/environ/src/component/translate/inline.rs@@ -775,16 +775,6 @@ impl<'a> Inliner<'a> {));frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));}- ThreadYield { func, cancellable } => {- let index = self.result.trampolines.push((- *func,- dfg::Trampoline::ThreadYield {- instance: frame.instance,- cancellable: *cancellable,- },- ));- frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));- }SubtaskDrop { func } => {let index = self.result.trampolines.push((*func,@@ -1131,49 +1121,69 @@ impl<'a> Inliner<'a> {));frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));}- ThreadSuspendToSuspended { func, cancellable } => {+ ThreadResumeLater { func } => {+ let index = self.result.trampolines.push((+ *func,+ dfg::Trampoline::ThreadResumeLater {+ instance: frame.instance,+ },+ ));+ frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));+ }+ ThreadSuspend { func, cancellable } => {let index = self.result.trampolines.push((*func,- dfg::Trampoline::ThreadSuspendToSuspended {+ dfg::Trampoline::ThreadSuspend {instance: frame.instance,cancellable: *cancellable,},));frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));}- ThreadSuspendTo { func, cancellable } => {+ ThreadYield { func, cancellable } => {let index = self.result.trampolines.push((*func,- dfg::Trampoline::ThreadSuspendTo {+ dfg::Trampoline::ThreadYield {instance: frame.instance,cancellable: *cancellable,},));frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));}- ThreadSuspend { func, cancellable } => {+ ThreadSuspendThenResume { func, cancellable } => {let index = self.result.trampolines.push((*func,- dfg::Trampoline::ThreadSuspend {+ dfg::Trampoline::ThreadSuspendThenResume {+ instance: frame.instance,+ cancellable: *cancellable,+ },+ ));+ frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));+ }+ ThreadYieldThenResume { func, cancellable } => {+ let index = self.result.trampolines.push((+ *func,+ dfg::Trampoline::ThreadYieldThenResume {instance: frame.instance,cancellable: *cancellable,},));frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));}- ThreadUnsuspend { func } => {+ ThreadSuspendThenPromote { func, cancellable } => {let index = self.result.trampolines.push((*func,- dfg::Trampoline::ThreadUnsuspend {+ dfg::Trampoline::ThreadSuspendThenPromote {instance: frame.instance,+ cancellable: *cancellable,},));frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));}- ThreadYieldToSuspended { func, cancellable } => {+ ThreadYieldThenPromote { func, cancellable } => {let index = self.result.trampolines.push((*func,- dfg::Trampoline::ThreadYieldToSuspended {+ dfg::Trampoline::ThreadYieldThenPromote {instance: frame.instance,cancellable: *cancellable,},diff --git a/crates/wasmtime/src/runtime/vm/component/libcalls.rs b/crates/wasmtime/src/runtime/vm/component/libcalls.rsindex 2484a09db1..f62ea58d9c 100644--- a/crates/wasmtime/src/runtime/vm/component/libcalls.rs+++ b/crates/wasmtime/src/runtime/vm/component/libcalls.rs@@ -801,24 +801,6 @@ fn waitable_join()}-#[cfg(feature = "component-model-async")]-fn thread_yield(- store: &mut dyn VMStore,- instance: Instance,- caller_instance: u32,- cancellable: u8,-) -> Result<bool> {- instance- .suspension_intrinsic(- store,- RuntimeComponentInstanceIndex::from_u32(caller_instance),- cancellable != 0,- true,- SuspensionTarget::None,- )- .map(|r| r == WaitResult::Cancelled)-}-#[cfg(feature = "component-model-async")]fn subtask_drop(store: &mut dyn VMStore,@@ -1342,12 +1324,27 @@ fn thread_new_indirect(}#[cfg(feature = "component-model-async")]-fn thread_suspend_to_suspended(+fn thread_resume_later(+ store: &mut dyn VMStore,+ instance: Instance,+ caller_instance: u32,+ thread_idx: u32,+) -> Result<()> {+ instance.resume_thread(+ store,+ RuntimeComponentInstanceIndex::from_u32(caller_instance),+ thread_idx,+ false,+ false,+ )+}++#[cfg(feature = "component-model-async")]+fn thread_suspend(store: &mut dyn VMStore,instance: Instance,caller: u32,cancellable: u8,- thread_idx: u32,) -> Result<bool> {instance.suspension_intrinsic(@@ -1355,36 +1352,36 @@ fn thread_suspend_to_suspended(RuntimeComponentInstanceIndex::from_u32(caller),cancellable != 0,false,- SuspensionTarget::SomeSuspended(thread_idx),+ SuspensionTarget::None,).map(|r| r == WaitResult::Cancelled)}#[cfg(feature = "component-model-async")]-fn thread_suspend_to(+fn thread_yield(store: &mut dyn VMStore,instance: Instance,- caller: u32,+ caller_instance: u32,cancellable: u8,- thread_idx: u32,) -> Result<bool> {instance.suspension_intrinsic(store,- RuntimeComponentInstanceIndex::from_u32(caller),+ RuntimeComponentInstanceIndex::from_u32(caller_instance),cancellable != 0,- false,- SuspensionTarget::Some(thread_idx),+ true,+ SuspensionTarget::None,).map(|r| r == WaitResult::Cancelled)}#[cfg(feature = "component-model-async")]-fn thread_suspend(+fn thread_suspend_then_resume(store: &mut dyn VMStore,instance: Instance,caller: u32,cancellable: u8,+ thread_idx: u32,) -> Result<bool> {instance.suspension_intrinsic(@@ -1392,42 +1389,64 @@ fn thread_suspend(RuntimeComponentInstanceIndex::from_u32(caller),cancellable != 0,false,- SuspensionTarget::None,+ SuspensionTarget::SomeSuspended(thread_idx),).map(|r| r == WaitResult::Cancelled)}#[cfg(feature = "component-model-async")]-fn thread_unsuspend(+fn thread_yield_then_resume(store: &mut dyn VMStore,instance: Instance,caller_instance: u32,+ cancellable: u8,thread_idx: u32,-) -> Result<()> {- instance.resume_thread(- store,- RuntimeComponentInstanceIndex::from_u32(caller_instance),- thread_idx,- false,- false,- )+) -> Result<bool> {+ instance+ .suspension_intrinsic(+ store,+ RuntimeComponentInstanceIndex::from_u32(caller_instance),+ cancellable != 0,+ true,+ SuspensionTarget::SomeSuspended(thread_idx),+ )+ .map(|r| r == WaitResult::Cancelled)}#[cfg(feature = "component-model-async")]-fn thread_yield_to_suspended(+fn thread_suspend_then_promote(store: &mut dyn VMStore,instance: Instance,- caller_instance: u32,+ caller: u32,cancellable: u8,thread_idx: u32,) -> Result<bool> {instance.suspension_intrinsic(store,- RuntimeComponentInstanceIndex::from_u32(caller_instance),+ RuntimeComponentInstanceIndex::from_u32(caller),+ cancellable != 0,+ false,+ SuspensionTarget::Some(thread_idx),+ )+ .map(|r| r == WaitResult::Cancelled)+}++#[cfg(feature = "component-model-async")]+fn thread_yield_then_promote(+ store: &mut dyn VMStore,+ instance: Instance,+ caller: u32,+ cancellable: u8,+ thread_idx: u32,+) -> Result<bool> {+ instance+ .suspension_intrinsic(+ store,+ RuntimeComponentInstanceIndex::from_u32(caller),cancellable != 0,true,- SuspensionTarget::SomeSuspended(thread_idx),+ SuspensionTarget::Some(thread_idx),).map(|r| r == WaitResult::Cancelled)}diff --git a/supply-chain/imports.lock b/supply-chain/imports.lockindex 4f4fa02ab6..3d3d916b75 100644--- a/supply-chain/imports.lock+++ b/supply-chain/imports.lock@@ -1428,8 +1428,8 @@ user-login = "alexcrichton"user-name = "Alex Crichton"[[publisher.json-from-wast]]-version = "0.252.0"-when = "2026-06-12"+version = "0.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.libc]]@@ -1908,8 +1908,8 @@ user-login = "alexcrichton"user-name = "Alex Crichton"[[publisher.wasm-compose]]-version = "0.252.0"-when = "2026-06-12"+version = "0.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wasm-encoder]]@@ -1923,8 +1923,8 @@ when = "2026-05-28"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wasm-encoder]]-version = "0.252.0"-when = "2026-06-12"+version = "0.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wasm-metadata]]@@ -1939,13 +1939,13 @@ when = "2026-05-28"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wasm-metadata]]-version = "0.252.0"-when = "2026-06-12"+version = "0.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wasm-wave]]-version = "0.252.0"-when = "2026-06-12"+version = "0.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wasmparser]]@@ -1959,13 +1959,13 @@ when = "2026-05-28"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wasmparser]]-version = "0.252.0"-when = "2026-06-12"+version = "0.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wasmprinter]]-version = "0.252.0"-when = "2026-06-12"+version = "0.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wasmtime]]@@ -2119,13 +2119,13 @@ when = "2026-06-24"trusted-publisher = "github:bytecodealliance/wasmtime"[[publisher.wast]]-version = "252.0.0"-when = "2026-06-12"+version = "253.0.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wat]]-version = "1.252.0"-when = "2026-06-12"+version = "1.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wiggle]]@@ -2414,8 +2414,8 @@ when = "2026-05-28"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wit-component]]-version = "0.252.0"-when = "2026-06-12"+version = "0.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wit-parser]]@@ -2429,8 +2429,8 @@ when = "2026-05-28"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.wit-parser]]-version = "0.252.0"-when = "2026-06-12"+version = "0.253.0"+when = "2026-07-07"trusted-publisher = "github:bytecodealliance/wasm-tools"[[publisher.witx]]diff --git a/tests/all/component_model/async.rs b/tests/all/component_model/async.rsindex 6b93b7b2e1..62981f5f51 100644--- a/tests/all/component_model/async.rs+++ b/tests/all/component_model/async.rs@@ -853,14 +853,14 @@ async fn concurrent_sync_calls_to_async_host() -> Result<()> {(core module $m(import "" "await-three-calls" (func $await-three-calls))(import "" "thread.new-indirect" (func $thread-new-indirect (param i32 i32) (result i32)))- (import "" "thread.unsuspend" (func $thread-unsuspend (param i32)))+ (import "" "thread.resume-later" (func $thread-resume-later (param i32)))(import "libc" "__indirect_function_table" (table $indirect-function-table 1 funcref))(func (export "run")(call $thread-new-indirect (i32.const 0) (i32.const 0))- (call $thread-unsuspend)+ (call $thread-resume-later)(call $thread-new-indirect (i32.const 0) (i32.const 0))- (call $thread-unsuspend)+ (call $thread-resume-later)(call $await-three-calls))(func $thread-entry (param i32)@@ -875,14 +875,14 @@ async fn concurrent_sync_calls_to_async_host() -> Result<()> {(alias core export $libc "__indirect_function_table" (core table $indirect-function-table))(core func $thread-new-indirect(canon thread.new-indirect $start-func-ty (table $indirect-function-table)))- (core func $thread-unsuspend (canon thread.unsuspend))+ (core func $thread-resume-later (canon thread.resume-later))(core func $await-three-calls (canon lower (func $await-three-calls) ))(core instance $i (instantiate $m(with "" (instance(export "await-three-calls" (func $await-three-calls))(export "thread.new-indirect" (func $thread-new-indirect))- (export "thread.unsuspend" (func $thread-unsuspend))+ (export "thread.resume-later" (func $thread-resume-later))))(with "libc" (instance $libc))))diff --git a/tests/misc_testsuite/component-model-threading/many-threads-indexed.wast b/tests/misc_testsuite/component-model-threading/many-threads-indexed.wastindex 09258c2d65..9e74c33589 100644--- a/tests/misc_testsuite/component-model-threading/many-threads-indexed.wast+++ b/tests/misc_testsuite/component-model-threading/many-threads-indexed.wast@@ -32,11 +32,11 @@;; Import the threading builtins and the table from libc(import "" "thread.new-indirect" (func $thread-new-indirect (param i32 i32) (result i32)))(import "" "thread.suspend" (func $thread-suspend (result i32)))- (import "" "thread.yield-to-suspended" (func $thread-yield-to-suspended (param i32) (result i32)))- (import "" "thread.suspend-to-suspended" (func $thread-suspend-to-suspended (param i32) (result i32)))+ (import "" "thread.yield-then-resume" (func $thread-yield-then-resume (param i32) (result i32)))+ (import "" "thread.suspend-then-resume" (func $thread-suspend-then-resume (param i32) (result i32)))(import "" "thread.yield" (func $thread-yield (result i32)))(import "" "thread.index" (func $thread-index (result i32)))- (import "" "thread.unsuspend" (func $thread-unsuspend (param i32)))+ (import "" "thread.resume-later" (func $thread-resume-later (param i32)))(import "libc" "__indirect_function_table" (table $indirect-function-table 1 funcref));; A memory block that threads will write their thread indexes and assigned values into@@ -63,7 +63,7 @@(func $new-thread (param i32)(drop- (call $thread-yield-to-suspended+ (call $thread-yield-then-resume(call $thread-new-indirect (i32.const 0) (local.get 0)))));; The main entry point@@ -76,11 +76,11 @@(call $new-thread (i32.const 8));; Yield to all threads in ascending order of assigned number- (drop (call $thread-yield-to-suspended (i32.load (i32.const 0))))- (drop (call $thread-yield-to-suspended (i32.load (i32.const 4))))- (drop (call $thread-yield-to-suspended (i32.load (i32.const 8))))- (drop (call $thread-yield-to-suspended (i32.load (i32.const 12))))- (drop (call $thread-yield-to-suspended (i32.load (i32.const 16))))+ (drop (call $thread-yield-then-resume (i32.load (i32.const 0))))+ (drop (call $thread-yield-then-resume (i32.load (i32.const 4))))+ (drop (call $thread-yield-then-resume (i32.load (i32.const 8))))+ (drop (call $thread-yield-then-resume (i32.load (i32.const 12))))+ (drop (call $thread-yield-then-resume (i32.load (i32.const 16))));; Ensure all assigned numbers have been written to the buffer in order(if (i32.ne (i32.load (i32.const 20)) (i32.const 0)) (then unreachable))@@ -102,9 +102,9 @@(canon thread.new-indirect $start-func-ty (table $indirect-function-table)))(core func $thread-yield (canon thread.yield))(core func $thread-index (canon thread.index))- (core func $thread-yield-to-suspended (canon thread.yield-to-suspended))- (core func $thread-unsuspend (canon thread.unsuspend))- (core func $thread-suspend-to-suspended (canon thread.suspend-to-suspended))+ (core func $thread-yield-then-resume (canon thread.yield-then-resume))+ (core func $thread-resume-later (canon thread.resume-later))+ (core func $thread-suspend-then-resume (canon thread.suspend-then-resume))(core func $thread-suspend (canon thread.suspend));; Instantiate the main module@@ -113,11 +113,11 @@(with "" (instance(export "thread.new-indirect" (func $thread-new-indirect))(export "thread.index" (func $thread-index))- (export "thread.yield-to-suspended" (func $thread-yield-to-suspended))+ (export "thread.yield-then-resume" (func $thread-yield-then-resume))(export "thread.yield" (func $thread-yield))- (export "thread.suspend-to-suspended" (func $thread-suspend-to-suspended))+ (export "thread.suspend-then-resume" (func $thread-suspend-then-resume))(export "thread.suspend" (func $thread-suspend))- (export "thread.unsuspend" (func $thread-unsuspend))))+ (export "thread.resume-later" (func $thread-resume-later))))(with "libc" (instance $libc))));; Export the main entry pointdiff --git a/tests/misc_testsuite/component-model-threading/stackful-cancellation.wast b/tests/misc_testsuite/component-model-threading/stackful-cancellation.wastindex 67f8452025..78968728b5 100644--- a/tests/misc_testsuite/component-model-threading/stackful-cancellation.wast+++ b/tests/misc_testsuite/component-model-threading/stackful-cancellation.wast@@ -14,7 +14,7 @@;; The caller cancels the subtask during the first yield, and ensures that the cancellation only takes effect;; on the second yield.-;; `run-yield-to-suspended`: Yields twice to a spawned thread, first with an uncancellable yield, then with a cancellable yield.+;; `run-yield-then-resume`: Yields twice to a spawned thread, first with an uncancellable yield, then with a cancellable yield.;; A complication is that we can't guarantee that if the spawned thread yields, the supertask will be scheduled to;; cancel the subtask before the subtask's implicit thread is rescheduled. To handle this, the subtask's implicit;; thread first waits on a future to be written by the supertask, then yields to the spawned thread.@@ -26,7 +26,7 @@;; The caller cancels the subtask during the first suspend, writes to the future to make the spawned thread;; resume the implicit thread, and ensures that the cancellation only takes effect on the second suspend.-;; `run-suspend-to-suspended`: Similar to `run-suspend`, but uses `thread.suspend-to-suspended` instead of `thread.suspend`.+;; `run-suspend-then-resume`: Similar to `run-suspend`, but uses `thread.suspend-then-resume` instead of `thread.suspend`.;; -- Component D --@@ -49,14 +49,14 @@(import "" "thread.new-indirect" (func $thread-new-indirect (param i32 i32) (result i32)))(import "" "thread.suspend" (func $thread-suspend (result i32)))(import "" "thread.suspend-cancellable" (func $thread-suspend-cancellable (result i32)))- (import "" "thread.yield-to-suspended" (func $thread-yield-to-suspended (param i32) (result i32)))- (import "" "thread.yield-to-suspended-cancellable" (func $thread-yield-to-suspended-cancellable (param i32) (result i32)))- (import "" "thread.suspend-to-suspended" (func $thread-suspend-to-suspended (param i32) (result i32)))- (import "" "thread.suspend-to-suspended-cancellable" (func $thread-suspend-to-suspended-cancellable (param i32) (result i32)))+ (import "" "thread.yield-then-resume" (func $thread-yield-then-resume (param i32) (result i32)))+ (import "" "thread.yield-then-resume-cancellable" (func $thread-yield-then-resume-cancellable (param i32) (result i32)))+ (import "" "thread.suspend-then-resume" (func $thread-suspend-then-resume (param i32) (result i32)))+ (import "" "thread.suspend-then-resume-cancellable" (func $thread-suspend-then-resume-cancellable (param i32) (result i32)))(import "" "thread.yield" (func $thread-yield (result i32)))(import "" "thread.yield-cancellable" (func $thread-yield-cancellable (result i32)))(import "" "thread.index" (func $thread-index (result i32)))- (import "" "thread.unsuspend" (func $thread-unsuspend (param i32)))+ (import "" "thread.resume-later" (func $thread-resume-later (param i32)))(import "" "future.read" (func $future.read (param i32 i32) (result i32)))(import "" "waitable.join" (func $waitable.join (param i32 i32)))(import "" "waitable-set.new" (func $waitable-set.new (result i32)))@@ -93,7 +93,7 @@;; Wait for the supertask to signal us to wake up suspended thread.(call $wait-for-future-write (local.get $future));; Resume the main thread, which is suspended in an uncancellable suspend- (call $thread-unsuspend (local.get $thread-index))+ (call $thread-resume-later (local.get $thread-index)))(func $just-yield (param $explicit-thread-idx i32)@@ -106,7 +106,7 @@(elem (table $indirect-function-table) (i32.const 0 (; wake-from-suspend-ftbl-idx ;)) func $wake-from-suspend)(elem (table $indirect-function-table) (i32.const 1 (; just-yield-ftbl-idx ;)) func $just-yield)- (func (export "run-yield-to-suspended") (param $futr i32)+ (func (export "run-yield-then-resume") (param $futr i32)(local $thread-index i32);; Spawn a new thread that will wake us up from our uncancellable suspend; we'll switch to it next(local.set $thread-index@@ -121,9 +121,9 @@;; Yield to the spawned thread uncancellably. We should eventually be rescheduled without being notified;; of the pending cancellation.- (if (i32.ne (call $thread-yield-to-suspended (local.get $thread-index)) (i32.const 0)) (then unreachable))+ (if (i32.ne (call $thread-yield-then-resume (local.get $thread-index)) (i32.const 0)) (then unreachable));; Yield to the spawned thread again. This time we should see the cancellation immediately.- (if (i32.ne (call $thread-yield-to-suspended-cancellable (local.get $thread-index)) (i32.const 1)) (then unreachable))+ (if (i32.ne (call $thread-yield-then-resume-cancellable (local.get $thread-index)) (i32.const 1)) (then unreachable))(call $task-cancel))@@ -138,7 +138,7 @@;; Spawn a new thread that will wake us up from our uncancellable suspend and schedule;; it to resume after we suspend.- (call $thread-unsuspend+ (call $thread-resume-later(call $thread-new-indirect (global.get $wake-from-suspend-ftbl-idx) (local.get $wake-from-suspend-argp)));; Request suspension. We will not be woken up by cancellation, because this is an uncancellable@@ -150,7 +150,7 @@(call $task-cancel))- (func (export "run-suspend-to-suspended") (param $futr i32)+ (func (export "run-suspend-then-resume") (param $futr i32)(local $thread-index i32);; Set up the arguments for the wake-for-suspend thread start function.;; It expects a pointer to a structure containing the thread index to resume@@ -168,9 +168,9 @@;; We will not be woken up by cancellation, because this is an uncancellable suspend.;; We will be woken up by the other thread we spawned above, which will be resumed after;; the supertask cancels our subtask.- (if (i32.ne (call $thread-suspend-to-suspended (local.get $thread-index)) (i32.const 0)) (then unreachable))+ (if (i32.ne (call $thread-suspend-then-resume (local.get $thread-index)) (i32.const 0)) (then unreachable));; Request suspension again. This time we should see the cancellation immediately.- (if (i32.ne (call $thread-suspend-to-suspended-cancellable (local.get $thread-index)) (i32.const 1)) (then unreachable))+ (if (i32.ne (call $thread-suspend-then-resume-cancellable (local.get $thread-index)) (i32.const 1)) (then unreachable))(call $task-cancel)))@@ -187,11 +187,11 @@(core func $thread-yield (canon thread.yield))(core func $thread-yield-cancellable (canon thread.yield cancellable))(core func $thread-index (canon thread.index))- (core func $thread-yield-to-suspended (canon thread.yield-to-suspended))- (core func $thread-yield-to-suspended-cancellable (canon thread.yield-to-suspended cancellable))- (core func $thread-unsuspend (canon thread.unsuspend))- (core func $thread-suspend-to-suspended (canon thread.suspend-to-suspended))- (core func $thread-suspend-to-suspended-cancellable (canon thread.suspend-to-suspended cancellable))+ (core func $thread-yield-then-resume (canon thread.yield-then-resume))+ (core func $thread-yield-then-resume-cancellable (canon thread.yield-then-resume cancellable))+ (core func $thread-resume-later (canon thread.resume-later))+ (core func $thread-suspend-then-resume (canon thread.suspend-then-resume))+ (core func $thread-suspend-then-resume-cancellable (canon thread.suspend-then-resume cancellable))(core func $thread-suspend (canon thread.suspend))(core func $thread-suspend-cancellable (canon thread.suspend cancellable))(core func $future.read (canon future.read $FT (memory $memory "mem")))@@ -207,15 +207,15 @@(export "task.cancel" (func $task-cancel))(export "thread.new-indirect" (func $thread-new-indirect))(export "thread.index" (func $thread-index))- (export "thread.yield-to-suspended" (func $thread-yield-to-suspended))- (export "thread.yield-to-suspended-cancellable" (func $thread-yield-to-suspended-cancellable))+ (export "thread.yield-then-resume" (func $thread-yield-then-resume))+ (export "thread.yield-then-resume-cancellable" (func $thread-yield-then-resume-cancellable))(export "thread.yield" (func $thread-yield))(export "thread.yield-cancellable" (func $thread-yield-cancellable))- (export "thread.suspend-to-suspended" (func $thread-suspend-to-suspended))- (export "thread.suspend-to-suspended-cancellable" (func $thread-suspend-to-suspended-cancellable))+ (export "thread.suspend-then-resume" (func $thread-suspend-then-resume))+ (export "thread.suspend-then-resume-cancellable" (func $thread-suspend-then-resume-cancellable))(export "thread.suspend" (func $thread-suspend))(export "thread.suspend-cancellable" (func $thread-suspend-cancellable))- (export "thread.unsuspend" (func $thread-unsuspend))+ (export "thread.resume-later" (func $thread-resume-later))(export "future.read" (func $future.read))(export "waitable.join" (func $waitable.join))(export "waitable-set.wait" (func $waitable-set.wait))@@ -223,17 +223,17 @@(with "libc" (instance $libc))))(func (export "run-yield") async (result u32) (canon lift (core func $cm "run-yield") async))- (func (export "run-yield-to-suspended") async (param "fut" $FT) (result u32) (canon lift (core func $cm "run-yield-to-suspended") async))+ (func (export "run-yield-then-resume") async (param "fut" $FT) (result u32) (canon lift (core func $cm "run-yield-then-resume") async))(func (export "run-suspend") async (param "fut" $FT) (result u32) (canon lift (core func $cm "run-suspend") async))- (func (export "run-suspend-to-suspended") async (param "fut" $FT) (result u32) (canon lift (core func $cm "run-suspend-to-suspended") async))+ (func (export "run-suspend-then-resume") async (param "fut" $FT) (result u32) (canon lift (core func $cm "run-suspend-then-resume") async)))(component $D(type $FT (future))(import "run-yield" (func $run-yield async (result u32)))- (import "run-yield-to-suspended" (func $run-yield-to-suspended async (param "fut" $FT) (result u32)))+ (import "run-yield-then-resume" (func $run-yield-then-resume async (param "fut" $FT) (result u32)))(import "run-suspend" (func $run-suspend async (param "fut" $FT) (result u32)))- (import "run-suspend-to-suspended" (func $run-suspend-to-suspended async (param "fut" $FT) (result u32)))+ (import "run-suspend-then-resume" (func $run-suspend-then-resume async (param "fut" $FT) (result u32)))(core module $Memory (memory (export "mem") 1))(core instance $memory (instantiate $Memory))@@ -241,9 +241,9 @@(import "" "mem" (memory 1))(import "" "subtask.cancel" (func $subtask.cancel (param i32) (result i32)))(import "" "run-yield" (func $run-yield (param i32) (result i32)))- (import "" "run-yield-to-suspended" (func $run-yield-to-suspended (param i32 i32) (result i32)))+ (import "" "run-yield-then-resume" (func $run-yield-then-resume (param i32 i32) (result i32)))(import "" "run-suspend" (func $run-suspend (param i32 i32) (result i32)))- (import "" "run-suspend-to-suspended" (func $run-suspend-to-suspended (param i32 i32) (result i32)))+ (import "" "run-suspend-then-resume" (func $run-suspend-then-resume (param i32 i32) (result i32)))(import "" "waitable.join" (func $waitable.join (param i32 i32)))(import "" "waitable-set.new" (func $waitable-set.new (result i32)))(import "" "waitable-set.wait" (func $waitable-set.wait (param i32 i32) (result i32)))@@ -257,7 +257,7 @@(local $run-retp i32) (local $wait-retp i32)(local $ret64 i64) (local $futr i32) (local $futw i32)- ;; Set up return value storage for run-suspend/suspend-to-suspended and waitable-set.wait+ ;; Set up return value storage for run-suspend/suspend-then-resume and waitable-set.wait(local.set $run-retp (i32.const 4))(local.set $wait-retp (i32.const 8))(i32.store (local.get $run-retp) (i32.const 0xbad0bad0))@@ -268,20 +268,20 @@(local.set $futr (i32.wrap_i64 (local.get $ret64)))(local.set $futw (i32.wrap_i64 (i64.shr_u (local.get $ret64) (i64.const 32))))- ;; Calling run-suspend/suspend-to-suspended will start the thread, which will suspend.+ ;; Calling run-suspend/suspend-then-resume will start the thread, which will suspend.;; This is basically a switch statement:;; 0: run-yield- ;; 1: run-yield-to-suspended+ ;; 1: run-yield-then-resume;; 2: run-suspend- ;; 3: run-suspend-to-suspended+ ;; 3: run-suspend-then-resume(if (i32.eq (local.get $test-id) (i32.const 0))(then (local.set $ret (call $run-yield (local.get $run-retp))))(else (if (i32.eq (local.get $test-id) (i32.const 1))- (then (local.set $ret (call $run-yield-to-suspended (local.get $futr) (local.get $run-retp))))+ (then (local.set $ret (call $run-yield-then-resume (local.get $futr) (local.get $run-retp))))(else (if (i32.eq (local.get $test-id) (i32.const 2))(then (local.set $ret (call $run-suspend (local.get $futr) (local.get $run-retp))))(else (if (i32.eq (local.get $test-id) (i32.const 3))- (then (local.set $ret (call $run-suspend-to-suspended (local.get $futr) (local.get $run-retp))))+ (then (local.set $ret (call $run-suspend-then-resume (local.get $futr) (local.get $run-retp))))(else unreachable))))))));; Ensure that the thread started@@ -327,7 +327,7 @@(if (i32.ne (call $run-test (i32.const 0)) (i32.const 42))(then unreachable))- ;; test-id 1: run-yield-to-suspended+ ;; test-id 1: run-yield-then-resume(if (i32.ne (call $run-test (i32.const 1)) (i32.const 42))(then unreachable))@@ -335,7 +335,7 @@(if (i32.ne (call $run-test (i32.const 2)) (i32.const 42))(then unreachable))- ;; test-id 3: run-suspend-to-suspended+ ;; test-id 3: run-suspend-then-resume(if (i32.ne (call $run-test (i32.const 3)) (i32.const 42))(then unreachable))@@ -353,14 +353,14 @@(core func $thread.yield (canon thread.yield))(canon lower (func $run-yield) async (memory $memory "mem") (core func $run-yield'))(canon lower (func $run-suspend) async (memory $memory "mem") (core func $run-suspend'))- (canon lower (func $run-suspend-to-suspended) async (memory $memory "mem") (core func $run-suspend-to-suspended'))- (canon lower (func $run-yield-to-suspended) async (memory $memory "mem") (core func $run-yield-to-suspended'))+ (canon lower (func $run-suspend-then-resume) async (memory $memory "mem") (core func $run-suspend-then-resume'))+ (canon lower (func $run-yield-then-resume) async (memory $memory "mem") (core func $run-yield-then-resume'))(core instance $dm (instantiate $DM (with "" (instance(export "mem" (memory $memory "mem"))(export "run-yield" (func $run-yield'))(export "run-suspend" (func $run-suspend'))- (export "run-suspend-to-suspended" (func $run-suspend-to-suspended'))- (export "run-yield-to-suspended" (func $run-yield-to-suspended'))+ (export "run-suspend-then-resume" (func $run-suspend-then-resume'))+ (export "run-yield-then-resume" (func $run-yield-then-resume'))(export "waitable.join" (func $waitable.join))(export "waitable-set.new" (func $waitable-set.new))(export "waitable-set.wait" (func $waitable-set.wait))@@ -375,9 +375,9 @@(instance $c (instantiate $C))(instance $d (instantiate $D(with "run-yield" (func $c "run-yield"))- (with "run-yield-to-suspended" (func $c "run-yield-to-suspended"))+ (with "run-yield-then-resume" (func $c "run-yield-then-resume"))(with "run-suspend" (func $c "run-suspend"))- (with "run-suspend-to-suspended" (func $c "run-suspend-to-suspended"))+ (with "run-suspend-then-resume" (func $c "run-suspend-then-resume"))))(func (export "run") (alias export $d "run")))diff --git a/tests/misc_testsuite/component-model-threading/suspend-trap.wast b/tests/misc_testsuite/component-model-threading/suspend-trap.wastindex e0125e74c5..3d2256e260 100644--- a/tests/misc_testsuite/component-model-threading/suspend-trap.wast+++ b/tests/misc_testsuite/component-model-threading/suspend-trap.wast@@ -9,7 +9,7 @@)(core module $CM(import "" "thread.new-indirect" (func $thread.new-indirect (param i32 i32) (result i32)))- (import "" "thread.yield-to-suspended" (func $thread.yield-to-suspended (param i32) (result i32)))+ (import "" "thread.yield-then-resume" (func $thread.yield-then-resume (param i32) (result i32)))(import "" "thread.yield" (func $thread.yield (result i32)))(import "libc" "mem" (memory 1))(import "libc" "table" (table $table 2 funcref))@@ -20,10 +20,10 @@(local.set $id (call $thread.new-indirect (i32.const 0) (i32.const 0)));; Resume it, which will come back here due to `$thread.yield`- (drop (call $thread.yield-to-suspended (local.get $id)))+ (drop (call $thread.yield-then-resume (local.get $id)));; try to resume it again and this should trap.- (drop (call $thread.yield-to-suspended (local.get $id)))+ (drop (call $thread.yield-then-resume (local.get $id))))(func $child (param i32)@@ -39,12 +39,12 @@(core func $thread-new-indirect(canon thread.new-indirect $start-func-ty (table $libc "table")))(core func $thread-yield (canon thread.yield))- (core func $thread-yield-to-suspended (canon thread.yield-to-suspended))+ (core func $thread-yield-then-resume (canon thread.yield-then-resume))(core instance $cm (instantiate $CM(with "" (instance(export "thread.new-indirect" (func $thread-new-indirect))- (export "thread.yield-to-suspended" (func $thread-yield-to-suspended))+ (export "thread.yield-then-resume" (func $thread-yield-then-resume))(export "thread.yield" (func $thread-yield))))(with "libc" (instance $libc))diff --git a/tests/misc_testsuite/component-model-threading/threading-builtins.wast b/tests/misc_testsuite/component-model-threading/threading-builtins.wastindex b695b14e50..9889c2b9ce 100644--- a/tests/misc_testsuite/component-model-threading/threading-builtins.wast+++ b/tests/misc_testsuite/component-model-threading/threading-builtins.wast@@ -13,11 +13,11 @@;; Import the threading builtins and the table from libc(import "" "thread.new-indirect" (func $thread-new-indirect (param i32 i32) (result i32)))(import "" "thread.suspend" (func $thread-suspend (result i32)))- (import "" "thread.yield-to-suspended" (func $thread-yield-to-suspended (param i32) (result i32)))- (import "" "thread.suspend-to-suspended" (func $thread-suspend-to-suspended (param i32) (result i32)))+ (import "" "thread.yield-then-resume" (func $thread-yield-then-resume (param i32) (result i32)))+ (import "" "thread.suspend-then-resume" (func $thread-suspend-then-resume (param i32) (result i32)))(import "" "thread.yield" (func $thread-yield (result i32)))(import "" "thread.index" (func $thread-index (result i32)))- (import "" "thread.unsuspend" (func $thread-unsuspend (param i32)))+ (import "" "thread.resume-later" (func $thread-resume-later (param i32)))(import "libc" "__indirect_function_table" (table $indirect-function-table 1 funcref));; A global that we will set from the spawned thread@@ -29,17 +29,17 @@;; Set the global to the context value(global.set $g (local.get 0));; The main thread switched to us, so is no longer scheduled, so we explicitly schedule it- (call $thread-unsuspend (global.get $main-thread-index))+ (call $thread-resume-later (global.get $main-thread-index));; Yield back to the main thread (since that is the only other one)(drop (call $thread-yield);; Increment the global(global.set $g (i32.add (global.get $g) (i32.const 1)));; The main thread will have explicitly requested suspension, so yield to it directly- (drop (call $thread-yield-to-suspended (global.get $main-thread-index)))+ (drop (call $thread-yield-then-resume (global.get $main-thread-index)));; Increment the global again(global.set $g (i32.add (global.get $g) (i32.const 1)));; Reschedule the main thread so that it runs after we exit- (call $thread-unsuspend (global.get $main-thread-index))))+ (call $thread-resume-later (global.get $main-thread-index))))(export "thread-start" (func $thread-start));; Initialize the function table with our thread-start function; this will be@@ -53,7 +53,7 @@(global.set $main-thread-index (call $thread-index));; Create a new thread, which starts suspended, and switch to it(drop- (call $thread-suspend-to-suspended+ (call $thread-suspend-then-resume(call $thread-new-indirect (i32.const 0) (i32.const 42))));; After the thread yields back to us, check that the global was set to 42(if (i32.ne (global.get $g) (i32.const 42)) (then unreachable))@@ -78,9 +78,9 @@(canon thread.new-indirect $start-func-ty (table $indirect-function-table)))(core func $thread-yield (canon thread.yield))(core func $thread-index (canon thread.index))- (core func $thread-yield-to-suspended (canon thread.yield-to-suspended))- (core func $thread-unsuspend (canon thread.unsuspend))- (core func $thread-suspend-to-suspended (canon thread.suspend-to-suspended))+ (core func $thread-yield-then-resume (canon thread.yield-then-resume))+ (core func $thread-resume-later (canon thread.resume-later))+ (core func $thread-suspend-then-resume (canon thread.suspend-then-resume))(core func $thread-suspend (canon thread.suspend));; Instantiate the main module@@ -89,11 +89,11 @@(with "" (instance(export "thread.new-indirect" (func $thread-new-indirect))(export "thread.index" (func $thread-index))- (export "thread.yield-to-suspended" (func $thread-yield-to-suspended))+ (export "thread.yield-then-resume" (func $thread-yield-then-resume))(export "thread.yield" (func $thread-yield))- (export "thread.suspend-to-suspended" (func $thread-suspend-to-suspended))+ (export "thread.suspend-then-resume" (func $thread-suspend-then-resume))(export "thread.suspend" (func $thread-suspend))- (export "thread.unsuspend" (func $thread-unsuspend))))+ (export "thread.resume-later" (func $thread-resume-later))))(with "libc" (instance $libc))));; Export the main entry pointdiff --git a/tests/misc_testsuite/component-model-threading/threading-trap-in-post-return.wast b/tests/misc_testsuite/component-model-threading/threading-trap-in-post-return.wastindex 6e14ca359c..18fba270b7 100644--- a/tests/misc_testsuite/component-model-threading/threading-trap-in-post-return.wast+++ b/tests/misc_testsuite/component-model-threading/threading-trap-in-post-return.wast@@ -8,56 +8,74 @@(core type $ft (func (param i32)))(core func $thread.new-indirect (canon thread.new-indirect $ft (table $memory "t")))- (core func $thread.suspend-to-suspended (canon thread.suspend-to-suspended))(core func $thread.suspend (canon thread.suspend))- (core func $thread.unsuspend (canon thread.unsuspend))- (core func $thread.yield-to-suspended (canon thread.yield-to-suspended))+ (core func $thread.resume-later (canon thread.resume-later))+ (core func $thread.suspend-then-resume (canon thread.suspend-then-resume))+ (core func $thread.yield-then-resume (canon thread.yield-then-resume))+ (core func $thread.suspend-then-promote (canon thread.suspend-then-promote))+ (core func $thread.yield-then-promote (canon thread.yield-then-promote))(core module $DM(import "" "thread.new-indirect" (func $thread.new-indirect (param i32 i32) (result i32)))- (import "" "thread.suspend-to-suspended" (func $thread.suspend-to-suspended (param i32) (result i32)))(import "" "thread.suspend" (func $thread.suspend (result i32)))- (import "" "thread.unsuspend" (func $thread.unsuspend (param i32)))- (import "" "thread.yield-to-suspended" (func $thread.yield-to-suspended (param i32) (result i32)))+ (import "" "thread.resume-later" (func $thread.resume-later (param i32)))+ (import "" "thread.suspend-then-resume" (func $thread.suspend-then-resume (param i32) (result i32)))+ (import "" "thread.yield-then-resume" (func $thread.yield-then-resume (param i32) (result i32)))+ (import "" "thread.suspend-then-promote" (func $thread.suspend-then-promote (param i32) (result i32)))+ (import "" "thread.yield-then-promote" (func $thread.yield-then-promote (param i32) (result i32)))(func (export "noop"))(func (export "trap-calling-thread-new-indirect") (call $thread.new-indirect (i32.const 0) (i32.const 0)) drop)- (func (export "trap-calling-thread-suspend-to-suspended") (call $thread.suspend-to-suspended (i32.const 0)) drop)(func (export "trap-calling-thread-suspend") (call $thread.suspend) drop)- (func (export "trap-calling-thread-unsuspend") (call $thread.unsuspend (i32.const 0)))- (func (export "trap-calling-thread-yield-to-suspended") (call $thread.yield-to-suspended (i32.const 0)) drop)+ (func (export "trap-calling-thread-resume-later") (call $thread.resume-later (i32.const 0)))+ (func (export "trap-calling-thread-suspend-then-resume") (call $thread.suspend-then-resume (i32.const 0)) drop)+ (func (export "trap-calling-thread-yield-then-resume") (call $thread.yield-then-resume (i32.const 0)) drop)+ (func (export "trap-calling-thread-suspend-then-promote") (call $thread.suspend-then-promote (i32.const 0)) drop)+ (func (export "trap-calling-thread-yield-then-promote") (call $thread.yield-then-promote (i32.const 0)) drop))(core instance $dm (instantiate $DM (with "" (instance(export "thread.new-indirect" (func $thread.new-indirect))- (export "thread.suspend-to-suspended" (func $thread.suspend-to-suspended))(export "thread.suspend" (func $thread.suspend))- (export "thread.unsuspend" (func $thread.unsuspend))- (export "thread.yield-to-suspended" (func $thread.yield-to-suspended))+ (export "thread.resume-later" (func $thread.resume-later))+ (export "thread.suspend-then-resume" (func $thread.suspend-then-resume))+ (export "thread.yield-then-resume" (func $thread.yield-then-resume))+ (export "thread.suspend-then-promote" (func $thread.suspend-then-promote))+ (export "thread.yield-then-promote" (func $thread.yield-then-promote))))))(func (export "trap-calling-thread-new-indirect")(canon lift (core func $dm "noop")(post-return (func $dm "trap-calling-thread-new-indirect"))))- (func (export "trap-calling-thread-suspend-to-suspended")- (canon lift (core func $dm "noop")- (post-return (func $dm "trap-calling-thread-suspend-to-suspended"))))(func (export "trap-calling-thread-suspend")(canon lift (core func $dm "noop")(post-return (func $dm "trap-calling-thread-suspend"))))- (func (export "trap-calling-thread-unsuspend")+ (func (export "trap-calling-thread-resume-later")+ (canon lift (core func $dm "noop")+ (post-return (func $dm "trap-calling-thread-resume-later"))))+ (func (export "trap-calling-thread-suspend-then-resume")+ (canon lift (core func $dm "noop")+ (post-return (func $dm "trap-calling-thread-suspend-then-resume"))))+ (func (export "trap-calling-thread-yield-then-resume")+ (canon lift (core func $dm "noop")+ (post-return (func $dm "trap-calling-thread-yield-then-resume"))))+ (func (export "trap-calling-thread-suspend-then-promote")(canon lift (core func $dm "noop")- (post-return (func $dm "trap-calling-thread-unsuspend"))))- (func (export "trap-calling-thread-yield-to-suspended")+ (post-return (func $dm "trap-calling-thread-suspend-then-promote"))))+ (func (export "trap-calling-thread-yield-then-promote")(canon lift (core func $dm "noop")- (post-return (func $dm "trap-calling-thread-yield-to-suspended"))))+ (post-return (func $dm "trap-calling-thread-yield-then-promote")))))-(component instance $i0 $Tester)+(component instance $i $Tester)(assert_trap (invoke "trap-calling-thread-new-indirect") "cannot leave component instance")-(component instance $i1 $Tester)-(assert_trap (invoke "trap-calling-thread-suspend-to-suspended") "cannot leave component instance")-(component instance $i2 $Tester)+(component instance $i $Tester)(assert_trap (invoke "trap-calling-thread-suspend") "cannot leave component instance")-(component instance $i3 $Tester)-(assert_trap (invoke "trap-calling-thread-unsuspend") "cannot leave component instance")-(component instance $i4 $Tester)-(assert_trap (invoke "trap-calling-thread-yield-to-suspended") "cannot leave component instance")+(component instance $i $Tester)+(assert_trap (invoke "trap-calling-thread-resume-later") "cannot leave component instance")+(component instance $i $Tester)+(assert_trap (invoke "trap-calling-thread-suspend-then-resume") "cannot leave component instance")+(component instance $i $Tester)+(assert_trap (invoke "trap-calling-thread-yield-then-resume") "cannot leave component instance")+(component instance $i $Tester)+(assert_trap (invoke "trap-calling-thread-suspend-then-promote") "cannot leave component instance")+(component instance $i $Tester)+(assert_trap (invoke "trap-calling-thread-yield-then-promote") "cannot leave component instance")diff --git a/tests/misc_testsuite/component-model-threading/yield-cancellable.wast b/tests/misc_testsuite/component-model-threading/yield-cancellable.wastindex 2f92273300..80d6a8968b 100644--- a/tests/misc_testsuite/component-model-threading/yield-cancellable.wast+++ b/tests/misc_testsuite/component-model-threading/yield-cancellable.wast@@ -8,14 +8,14 @@(core type $start-func-ty (func (param i32)))(core func $thread.new-indirect(canon thread.new-indirect $start-func-ty (table $libc "t")))- (core func $thread.unsuspend (canon thread.unsuspend))+ (core func $thread.resume-later (canon thread.resume-later))(core func $thread.index (canon thread.index))(core func $thread.yield-cancellable (canon thread.yield cancellable))(core func $task.return (canon task.return))(core module $m(import "" "thread.new-indirect" (func $thread.new-indirect (param i32 i32) (result i32)))- (import "" "thread.unsuspend" (func $thread.unsuspend (param i32)))+ (import "" "thread.resume-later" (func $thread.resume-later (param i32)))(import "" "thread.index" (func $thread.index (result i32)))(import "" "thread.yield-cancellable" (func $thread.yield-cancellable (result i32)))(import "" "task.return" (func $task.return))@@ -25,7 +25,7 @@(func (export "run") (result i32)(local $tid i32)(local.set $tid (call $thread.new-indirect (i32.const 0) (call $thread.index)))- (call $thread.unsuspend (local.get $tid))+ (call $thread.resume-later (local.get $tid))i32.const 1 ;; CALLBACK_CODE_YIELD)@@ -46,7 +46,7 @@(core instance $i (instantiate $m (with "" (instance(export "thread.new-indirect" (func $thread.new-indirect))- (export "thread.unsuspend" (func $thread.unsuspend))+ (export "thread.resume-later" (func $thread.resume-later))(export "thread.index" (func $thread.index))(export "thread.yield-cancellable" (func $thread.yield-cancellable))(export "task.return" (func $task.return))diff --git a/tests/misc_testsuite/component-model/async/join-during-sync-read.wast b/tests/misc_testsuite/component-model/async/join-during-sync-read.wastindex f3f35b866e..ee792c3768 100644--- a/tests/misc_testsuite/component-model/async/join-during-sync-read.wast+++ b/tests/misc_testsuite/component-model/async/join-during-sync-read.wast@@ -12,7 +12,7 @@)(core module $m(import "" "thread.new-indirect" (func $thread.new-indirect (param i32 i32) (result i32)))- (import "" "thread.yield-to-suspended" (func $thread.yield-to-suspended (param i32) (result i32)))+ (import "" "thread.yield-then-resume" (func $thread.yield-then-resume (param i32) (result i32)))(import "" "waitable-set.new" (func $waitable-set.new (result i32)))(import "" "waitable.join" (func $waitable.join (param i32 i32)))(import "" "future.new" (func $future.new (result i64)))@@ -29,7 +29,7 @@(local.set $pair (call $future.new))(local.set $future (i32.wrap_i64 (i64.and (local.get $pair) (i64.const 0xFFFFFFFF))))(local.set $set (call $waitable-set.new))- (drop (call $thread.yield-to-suspended (call $thread.new-indirect (i32.const 0) (local.get $future))))+ (drop (call $thread.yield-then-resume (call $thread.new-indirect (i32.const 0) (local.get $future))));; Should trap, since sync read is still pending:(call $waitable.join (local.get $future) (local.get $set))unreachable@@ -41,17 +41,17 @@(alias core export $libc "table" (core table $table))(core func $thread.new-indirect (canon thread.new-indirect $start-func-ty (table $table)))- (core func $thread.yield-to-suspended (canon thread.yield-to-suspended))+ (core func $thread.yield-then-resume (canon thread.yield-then-resume))(core func $waitable-set.new (canon waitable-set.new))(core func $waitable.join (canon waitable.join))(type $future (future))(core func $future.new (canon future.new $future))(core func $future.read (canon future.read $future (memory $libc "memory")))-+(core instance $m (instantiate $m(with "" (instance(export "thread.new-indirect" (func $thread.new-indirect))- (export "thread.yield-to-suspended" (func $thread.yield-to-suspended))+ (export "thread.yield-then-resume" (func $thread.yield-then-resume))(export "waitable-set.new" (func $waitable-set.new))(export "waitable.join" (func $waitable.join))(export "future.new" (func $future.new))diff --git a/tests/misc_testsuite/component-model/async/task-deletion.wast b/tests/misc_testsuite/component-model/async/task-deletion.wastindex dd8d534665..76c08e6904 100644--- a/tests/misc_testsuite/component-model/async/task-deletion.wast+++ b/tests/misc_testsuite/component-model/async/task-deletion.wast@@ -22,14 +22,14 @@(import "" "thread.new-indirect" (func $thread-new-indirect (param i32 i32) (result i32)))(import "" "thread.suspend" (func $thread-suspend (result i32)))(import "" "thread.suspend-cancellable" (func $thread-suspend-cancellable (result i32)))- (import "" "thread.yield-to-suspended" (func $thread-yield-to-suspended (param i32) (result i32)))- (import "" "thread.yield-to-suspended-cancellable" (func $thread-yield-to-suspended-cancellable (param i32) (result i32)))- (import "" "thread.suspend-to" (func $thread-suspend-to (param i32) (result i32)))- (import "" "thread.suspend-to-cancellable" (func $thread-suspend-to-cancellable (param i32) (result i32)))+ (import "" "thread.yield-then-resume" (func $thread-yield-then-resume (param i32) (result i32)))+ (import "" "thread.yield-then-resume-cancellable" (func $thread-yield-then-resume-cancellable (param i32) (result i32)))+ (import "" "thread.suspend-then-promote" (func $thread-suspend-then-promote (param i32) (result i32)))+ (import "" "thread.suspend-then-promote-cancellable" (func $thread-suspend-then-promote-cancellable (param i32) (result i32)))(import "" "thread.yield" (func $thread-yield (result i32)))(import "" "thread.yield-cancellable" (func $thread-yield-cancellable (result i32)))(import "" "thread.index" (func $thread-index (result i32)))- (import "" "thread.unsuspend" (func $thread-unsuspend (param i32)))+ (import "" "thread.resume-later" (func $thread-resume-later (param i32)))(import "" "waitable.join" (func $waitable.join (param i32 i32)))(import "" "waitable-set.new" (func $waitable-set.new (result i32)))(import "" "waitable-set.wait" (func $waitable-set.wait (param i32 i32) (result i32)))@@ -52,11 +52,11 @@(br $top)))(func (export "explicit-thread-calls-return-stackful")- (call $thread-unsuspend+ (call $thread-resume-later(call $thread-new-indirect (global.get $call-return-ftbl-idx) (i32.const 42))))(func (export "explicit-thread-calls-return-stackless") (result i32)- (call $thread-unsuspend+ (call $thread-resume-later(call $thread-new-indirect (global.get $call-return-ftbl-idx) (i32.const 42)))(i32.const 0 (; EXIT ;)))@@ -64,33 +64,33 @@(unreachable))(func (export "explicit-thread-suspends-sync") (result i32)- (call $thread-unsuspend+ (call $thread-resume-later(call $thread-new-indirect (global.get $suspend-ftbl-idx) (i32.const 42)))(i32.const 42))(func (export "explicit-thread-suspends-stackful")- (call $thread-unsuspend+ (call $thread-resume-later(call $thread-new-indirect (global.get $suspend-ftbl-idx) (i32.const 42)))(call $task-return (i32.const 42)))(func (export "explicit-thread-suspends-stackless") (result i32)- (call $thread-unsuspend+ (call $thread-resume-later(call $thread-new-indirect (global.get $suspend-ftbl-idx) (i32.const 42)))(call $task-return (i32.const 42))(i32.const 0))(func (export "explicit-thread-yield-loops-sync") (result i32)- (call $thread-unsuspend+ (call $thread-resume-later(call $thread-new-indirect (global.get $yield-loop-ftbl-idx) (i32.const 42)))(i32.const 42))(func (export "explicit-thread-yield-loops-stackful")- (call $thread-unsuspend+ (call $thread-resume-later(call $thread-new-indirect (global.get $yield-loop-ftbl-idx) (i32.const 42)))(call $task-return (i32.const 42)))(func (export "explicit-thread-yield-loops-stackless") (result i32)- (call $thread-unsuspend+ (call $thread-resume-later(call $thread-new-indirect (global.get $suspend-ftbl-idx) (i32.const 42)))(call $task-return (i32.const 42))(i32.const 0 (; EXIT ;)))@@ -114,11 +114,11 @@(core func $thread-yield (canon thread.yield))(core func $thread-yield-cancellable (canon thread.yield cancellable))(core func $thread-index (canon thread.index))- (core func $thread-yield-to-suspended (canon thread.yield-to-suspended))- (core func $thread-yield-to-suspended-cancellable (canon thread.yield-to-suspended cancellable))- (core func $thread-unsuspend (canon thread.unsuspend))- (core func $thread-suspend-to (canon thread.suspend-to))- (core func $thread-suspend-to-cancellable (canon thread.suspend-to cancellable))+ (core func $thread-yield-then-resume (canon thread.yield-then-resume))+ (core func $thread-yield-then-resume-cancellable (canon thread.yield-then-resume cancellable))+ (core func $thread-resume-later (canon thread.resume-later))+ (core func $thread-suspend-then-promote (canon thread.suspend-then-promote))+ (core func $thread-suspend-then-promote-cancellable (canon thread.suspend-then-promote cancellable))(core func $thread-suspend (canon thread.suspend))(core func $thread-suspend-cancellable (canon thread.suspend cancellable))(core func $waitable-set.new (canon waitable-set.new))@@ -134,15 +134,15 @@(export "task.cancel" (func $task-cancel))(export "thread.new-indirect" (func $thread-new-indirect))(export "thread.index" (func $thread-index))- (export "thread.yield-to-suspended" (func $thread-yield-to-suspended))- (export "thread.yield-to-suspended-cancellable" (func $thread-yield-to-suspended-cancellable))+ (export "thread.yield-then-resume" (func $thread-yield-then-resume))+ (export "thread.yield-then-resume-cancellable" (func $thread-yield-then-resume-cancellable))(export "thread.yield" (func $thread-yield))(export "thread.yield-cancellable" (func $thread-yield-cancellable))- (export "thread.suspend-to" (func $thread-suspend-to))- (export "thread.suspend-to-cancellable" (func $thread-suspend-to-cancellable))+ (export "thread.suspend-then-promote" (func $thread-suspend-then-promote))+ (export "thread.suspend-then-promote-cancellable" (func $thread-suspend-then-promote-cancellable))(export "thread.suspend" (func $thread-suspend))(export "thread.suspend-cancellable" (func $thread-suspend-cancellable))- (export "thread.unsuspend" (func $thread-unsuspend))+ (export "thread.resume-later" (func $thread-resume-later))(export "waitable.join" (func $waitable.join))(export "waitable-set.wait" (func $waitable-set.wait))(export "waitable-set.new" (func $waitable-set.new))))diff --git a/tests/misc_testsuite/component-model/async/task-return-traps.wast b/tests/misc_testsuite/component-model/async/task-return-traps.wastindex 1f8c5df9fd..94b2c7dc24 100644--- a/tests/misc_testsuite/component-model/async/task-return-traps.wast+++ b/tests/misc_testsuite/component-model/async/task-return-traps.wast@@ -24,12 +24,12 @@(core module $m(import "" "task.return" (func $task-return))(import "" "thread.new-indirect" (func $thread-new-indirect (param i32 i32) (result i32)))- (import "" "thread.unsuspend" (func $thread-unsuspend (param i32)))+ (import "" "thread.resume-later" (func $thread.resume-later (param i32)))(import "libc" "__indirect_function_table" (table $indirect-function-table 1 funcref))(func $thread-start (param i32) (; empty ;))(elem (table $indirect-function-table) (i32.const 0) func $thread-start)(func (export "foo") (result i32)- (call $thread-unsuspend+ (call $thread.resume-later(call $thread-new-indirect (i32.const 0) (i32.const 0)))i32.const 0)@@ -40,12 +40,12 @@(alias core export $libc "__indirect_function_table" (core table $indirect-function-table))(core func $thread-new-indirect(canon thread.new-indirect $start-func-ty (table $indirect-function-table)))- (core func $thread-unsuspend (canon thread.unsuspend))+ (core func $thread.resume-later (canon thread.resume-later))(core func $task-return (canon task.return))(core instance $i (instantiate $m(with "" (instance(export "thread.new-indirect" (func $thread-new-indirect))- (export "thread.unsuspend" (func $thread-unsuspend))+ (export "thread.resume-later" (func $thread.resume-later))(export "task.return" (func $task-return))))(with "libc" (instance $libc))@@ -61,12 +61,12 @@(core module $m(import "" "task.return" (func $task-return))(import "" "thread.new-indirect" (func $thread-new-indirect (param i32 i32) (result i32)))- (import "" "thread.unsuspend" (func $thread-unsuspend (param i32)))+ (import "" "thread.resume-later" (func $thread.resume-later (param i32)))(import "libc" "__indirect_function_table" (table $indirect-function-table 1 funcref))(func $thread-start (param i32) (; empty ;))(elem (table $indirect-function-table) (i32.const 0) func $thread-start)(func (export "foo")- (call $thread-unsuspend+ (call $thread.resume-later(call $thread-new-indirect (i32.const 0) (i32.const 0)))))@@ -75,12 +75,12 @@(alias core export $libc "__indirect_function_table" (core table $indirect-function-table))(core func $thread-new-indirect(canon thread.new-indirect $start-func-ty (table $indirect-function-table)))- (core func $thread-unsuspend (canon thread.unsuspend))+ (core func $thread.resume-later (canon thread.resume-later))(core func $task-return (canon task.return))(core instance $i (instantiate $m(with "" (instance(export "thread.new-indirect" (func $thread-new-indirect))- (export "thread.unsuspend" (func $thread-unsuspend))+ (export "thread.resume-later" (func $thread.resume-later))(export "task.return" (func $task-return))))(with "libc" (instance $libc))