diff --git a/ci/generate-spec-tests.rs b/ci/generate-spec-tests.rs index 6383d5f490..741e845691 100644 --- a/ci/generate-spec-tests.rs +++ b/ci/generate-spec-tests.rs @@ -91,6 +91,10 @@ fn copy_test(src: &Path, dst: &Path, features: fn(&Path) -> &str) { // Temporary exception until WebAssembly/component-model#704 lands Some("kebab.wast") => "FAIL", + // Temporary until WebAssembly/component-model#716 lands + Some("cancellable.wast") => "FAIL", + Some("binary.wast") if dst.ends_with("components/binary/binary.wast") => "FAIL", + Some(_) | None => "RUN", }; diff --git a/crates/wasm-encoder/src/component/builder.rs b/crates/wasm-encoder/src/component/builder.rs index 5c31a55fbe..8259f11609 100644 --- a/crates/wasm-encoder/src/component/builder.rs +++ b/crates/wasm-encoder/src/component/builder.rs @@ -664,16 +664,14 @@ impl ComponentBuilder { } /// Declares a new `waitable-set.wait` intrinsic. - pub fn waitable_set_wait(&mut self, cancellable: bool, memory: u32) -> u32 { - self.canonical_functions() - .waitable_set_wait(cancellable, memory); + pub fn waitable_set_wait(&mut self, memory: u32) -> u32 { + self.canonical_functions().waitable_set_wait(memory); self.core_funcs.add(Some("waitable-set.wait")) } /// Declares a new `waitable-set.poll` intrinsic. - pub fn waitable_set_poll(&mut self, cancellable: bool, memory: u32) -> u32 { - self.canonical_functions() - .waitable_set_poll(cancellable, memory); + pub fn waitable_set_poll(&mut self, memory: u32) -> u32 { + self.canonical_functions().waitable_set_poll(memory); self.core_funcs.add(Some("waitable-set.poll")) } @@ -709,42 +707,38 @@ impl ComponentBuilder { } /// Declares a new `thread.suspend` intrinsic. - pub fn thread_suspend(&mut self, cancellable: bool) -> u32 { - self.canonical_functions().thread_suspend(cancellable); + pub fn thread_suspend(&mut self) -> u32 { + self.canonical_functions().thread_suspend(); self.core_funcs.add(Some("thread.suspend")) } /// Declares a new `thread.yield` intrinsic. - pub fn thread_yield(&mut self, cancellable: bool) -> u32 { - self.canonical_functions().thread_yield(cancellable); + pub fn thread_yield(&mut self) -> u32 { + self.canonical_functions().thread_yield(); self.core_funcs.add(Some("thread.yield")) } /// Declares a new `thread.suspend-then-resume` intrinsic. - pub fn thread_suspend_then_resume(&mut self, cancellable: bool) -> u32 { - self.canonical_functions() - .thread_suspend_then_resume(cancellable); + pub fn thread_suspend_then_resume(&mut self) -> u32 { + self.canonical_functions().thread_suspend_then_resume(); self.core_funcs.add(Some("thread.suspend-then-resume")) } /// Declares a new `thread.yield-then-resume` intrinsic. - pub fn thread_yield_then_resume(&mut self, cancellable: bool) -> u32 { - self.canonical_functions() - .thread_yield_then_resume(cancellable); + pub fn thread_yield_then_resume(&mut self) -> u32 { + self.canonical_functions().thread_yield_then_resume(); self.core_funcs.add(Some("thread.yield-then-resume")) } /// Declares a new `thread.suspend-then-promote` intrinsic. - pub fn thread_suspend_then_promote(&mut self, cancellable: bool) -> u32 { - self.canonical_functions() - .thread_suspend_then_promote(cancellable); + pub fn thread_suspend_then_promote(&mut self) -> u32 { + self.canonical_functions().thread_suspend_then_promote(); self.core_funcs.add(Some("thread.suspend-then-promote")) } /// Declares a new `thread.yield-then-promote` intrinsic. - pub fn thread_yield_then_promote(&mut self, cancellable: bool) -> u32 { - self.canonical_functions() - .thread_yield_then_promote(cancellable); + pub fn thread_yield_then_promote(&mut self) -> u32 { + self.canonical_functions().thread_yield_then_promote(); self.core_funcs.add(Some("thread.yield-then-resume")) } diff --git a/crates/wasm-encoder/src/component/canonicals.rs b/crates/wasm-encoder/src/component/canonicals.rs index ebaccfe0a6..7369ebbab1 100644 --- a/crates/wasm-encoder/src/component/canonicals.rs +++ b/crates/wasm-encoder/src/component/canonicals.rs @@ -455,9 +455,9 @@ impl CanonicalFunctionSection { /// Declare a new `waitable-set.wait` intrinsic, used to block on a /// `waitable-set`. - pub fn waitable_set_wait(&mut self, async_: bool, memory: u32) -> &mut Self { + pub fn waitable_set_wait(&mut self, memory: u32) -> &mut Self { self.bytes.push(0x20); - self.bytes.push(if async_ { 1 } else { 0 }); + self.bytes.push(0); memory.encode(&mut self.bytes); self.num_added += 1; self @@ -465,9 +465,9 @@ impl CanonicalFunctionSection { /// Declare a new `waitable-set.wait` intrinsic, used to check, without /// blocking, if anything in a `waitable-set` is ready. - pub fn waitable_set_poll(&mut self, async_: bool, memory: u32) -> &mut Self { + pub fn waitable_set_poll(&mut self, memory: u32) -> &mut Self { self.bytes.push(0x21); - self.bytes.push(if async_ { 1 } else { 0 }); + self.bytes.push(0); memory.encode(&mut self.bytes); self.num_added += 1; self @@ -515,49 +515,49 @@ impl CanonicalFunctionSection { } /// Declare a new `thread.suspend` intrinsic. - pub fn thread_suspend(&mut self, cancellable: bool) -> &mut Self { + pub fn thread_suspend(&mut self) -> &mut Self { self.bytes.push(0x29); - self.bytes.push(if cancellable { 1 } else { 0 }); + self.bytes.push(0); self.num_added += 1; self } /// Declare a new `thread.yield` intrinsic. - pub fn thread_yield(&mut self, cancellable: bool) -> &mut Self { + pub fn thread_yield(&mut self) -> &mut Self { self.bytes.push(0x0c); - self.bytes.push(if cancellable { 1 } else { 0 }); + self.bytes.push(0); self.num_added += 1; self } /// Declare a new `thread.suspend-then-resume` intrinsic. - pub fn thread_suspend_then_resume(&mut self, cancellable: bool) -> &mut Self { + pub fn thread_suspend_then_resume(&mut self) -> &mut Self { self.bytes.push(0x2a); - self.bytes.push(if cancellable { 1 } else { 0 }); + self.bytes.push(0); self.num_added += 1; self } /// Declare a new `thread.yield-then-resume` intrinsic. - pub fn thread_yield_then_resume(&mut self, cancellable: bool) -> &mut Self { + pub fn thread_yield_then_resume(&mut self) -> &mut Self { self.bytes.push(0x2b); - self.bytes.push(if cancellable { 1 } else { 0 }); + self.bytes.push(0); self.num_added += 1; self } /// Declare a new `thread.suspend-then-promote` intrinsic. - pub fn thread_suspend_then_promote(&mut self, cancellable: bool) -> &mut Self { + pub fn thread_suspend_then_promote(&mut self) -> &mut Self { self.bytes.push(0x2c); - self.bytes.push(if cancellable { 1 } else { 0 }); + self.bytes.push(0); self.num_added += 1; self } /// Declare a new `thread.yield-then-promote` intrinsic. - pub fn thread_yield_then_promote(&mut self, cancellable: bool) -> &mut Self { + pub fn thread_yield_then_promote(&mut self) -> &mut Self { self.bytes.push(0x2d); - self.bytes.push(if cancellable { 1 } else { 0 }); + self.bytes.push(0); self.num_added += 1; self } diff --git a/crates/wasm-encoder/src/reencode/component.rs b/crates/wasm-encoder/src/reencode/component.rs index e1c47a0e07..332c8b520e 100644 --- a/crates/wasm-encoder/src/reencode/component.rs +++ b/crates/wasm-encoder/src/reencode/component.rs @@ -1091,17 +1091,11 @@ pub mod component_utils { wasmparser::CanonicalFunction::WaitableSetNew => { section.waitable_set_new(); } - wasmparser::CanonicalFunction::WaitableSetWait { - cancellable, - memory, - } => { - section.waitable_set_wait(cancellable, reencoder.memory_index(memory)?); + wasmparser::CanonicalFunction::WaitableSetWait { memory } => { + section.waitable_set_wait(reencoder.memory_index(memory)?); } - wasmparser::CanonicalFunction::WaitableSetPoll { - cancellable, - memory, - } => { - section.waitable_set_poll(cancellable, reencoder.memory_index(memory)?); + wasmparser::CanonicalFunction::WaitableSetPoll { memory } => { + section.waitable_set_poll(reencoder.memory_index(memory)?); } wasmparser::CanonicalFunction::WaitableSetDrop => { section.waitable_set_drop(); @@ -1123,23 +1117,23 @@ pub mod component_utils { wasmparser::CanonicalFunction::ThreadResumeLater => { section.thread_resume_later(); } - wasmparser::CanonicalFunction::ThreadSuspend { cancellable } => { - section.thread_suspend(cancellable); + wasmparser::CanonicalFunction::ThreadSuspend => { + section.thread_suspend(); } - wasmparser::CanonicalFunction::ThreadYield { cancellable } => { - section.thread_yield(cancellable); + wasmparser::CanonicalFunction::ThreadYield => { + section.thread_yield(); } - wasmparser::CanonicalFunction::ThreadSuspendThenResume { cancellable } => { - section.thread_suspend_then_resume(cancellable); + wasmparser::CanonicalFunction::ThreadSuspendThenResume => { + section.thread_suspend_then_resume(); } - wasmparser::CanonicalFunction::ThreadYieldThenResume { cancellable } => { - section.thread_yield_then_resume(cancellable); + wasmparser::CanonicalFunction::ThreadYieldThenResume => { + section.thread_yield_then_resume(); } - wasmparser::CanonicalFunction::ThreadSuspendThenPromote { cancellable } => { - section.thread_suspend_then_promote(cancellable); + wasmparser::CanonicalFunction::ThreadSuspendThenPromote => { + section.thread_suspend_then_promote(); } - wasmparser::CanonicalFunction::ThreadYieldThenPromote { cancellable } => { - section.thread_yield_then_promote(cancellable); + wasmparser::CanonicalFunction::ThreadYieldThenPromote => { + section.thread_yield_then_promote(); } } Ok(()) diff --git a/crates/wasmparser/src/readers/component/canonicals.rs b/crates/wasmparser/src/readers/component/canonicals.rs index 542ab3add2..f525c403cc 100644 --- a/crates/wasmparser/src/readers/component/canonicals.rs +++ b/crates/wasmparser/src/readers/component/canonicals.rs @@ -123,10 +123,7 @@ pub enum CanonicalFunction { }, /// A function which yields control to the host so that other tasks are able /// to make progress, if any. - ThreadYield { - /// If `true`, indicates the caller instance maybe reentered. - cancellable: bool, - }, + ThreadYield, /// A function to drop a specified task which has completed. SubtaskDrop, /// A function to cancel an in-progress task. @@ -257,17 +254,11 @@ pub enum CanonicalFunction { WaitableSetNew, /// A function to block on the next item within a `waitable-set`. WaitableSetWait { - /// Whether or not the guest can be reentered while calling this - /// function. - cancellable: bool, /// Which memory the results of this operation are stored in. memory: u32, }, /// A function to check if any items are ready within a `waitable-set`. WaitableSetPoll { - /// Whether or not the guest can be reentered while calling this - /// function. - cancellable: bool, /// Which memory the results of this operation are stored in. memory: u32, }, @@ -287,30 +278,15 @@ pub enum CanonicalFunction { /// A function to schedule the given thread to be resumed later. ThreadResumeLater, /// A function to suspend the current thread, immediately yielding to any transitive async-lowered calling component. - ThreadSuspend { - /// Whether or not the thread can be cancelled while suspended. - cancellable: bool, - }, + ThreadSuspend, /// The `thread.suspend-then-resume` intrinsic - ThreadSuspendThenResume { - /// Whether or not the thread can be cancelled while awaiting resumption. - cancellable: bool, - }, + ThreadSuspendThenResume, /// The `thread.yield-then-resume` intrinsic - ThreadYieldThenResume { - /// Whether or not the thread can be cancelled while yielding. - cancellable: bool, - }, + ThreadYieldThenResume, /// The `thread.suspend-then-promote` intrinsic - ThreadSuspendThenPromote { - /// Whether or not the thread can be cancelled while suspended. - cancellable: bool, - }, + ThreadSuspendThenPromote, /// The `thread.yield-then-promote` intrinsic - ThreadYieldThenPromote { - /// Whether or not the thread can be cancelled while yielding. - cancellable: bool, - }, + ThreadYieldThenPromote, } /// A reader for the canonical section of a WebAssembly component. @@ -409,14 +385,18 @@ impl<'a> FromReader<'a> for CanonicalFunction { 0x1e => CanonicalFunction::ErrorContextDrop, 0x1f => CanonicalFunction::WaitableSetNew, - 0x20 => CanonicalFunction::WaitableSetWait { - cancellable: reader.read()?, - memory: reader.read()?, - }, - 0x21 => CanonicalFunction::WaitableSetPoll { - cancellable: reader.read()?, - memory: reader.read()?, - }, + 0x20 => { + read_legacy_cancellation_byte(reader)?; + CanonicalFunction::WaitableSetWait { + memory: reader.read()?, + } + } + 0x21 => { + read_legacy_cancellation_byte(reader)?; + CanonicalFunction::WaitableSetPoll { + memory: reader.read()?, + } + } 0x22 => CanonicalFunction::WaitableSetDrop, 0x23 => CanonicalFunction::WaitableJoin, 0x26 => CanonicalFunction::ThreadIndex, @@ -425,24 +405,30 @@ impl<'a> FromReader<'a> for CanonicalFunction { table_index: reader.read()?, }, 0x28 => CanonicalFunction::ThreadResumeLater, - 0x29 => CanonicalFunction::ThreadSuspend { - cancellable: reader.read()?, - }, - 0x0c => CanonicalFunction::ThreadYield { - cancellable: reader.read()?, - }, - 0x2a => CanonicalFunction::ThreadSuspendThenResume { - cancellable: reader.read()?, - }, - 0x2b => CanonicalFunction::ThreadYieldThenResume { - cancellable: reader.read()?, - }, - 0x2c => CanonicalFunction::ThreadSuspendThenPromote { - cancellable: reader.read()?, - }, - 0x2d => CanonicalFunction::ThreadYieldThenPromote { - cancellable: reader.read()?, - }, + 0x29 => { + read_legacy_cancellation_byte(reader)?; + CanonicalFunction::ThreadSuspend + } + 0x0c => { + read_legacy_cancellation_byte(reader)?; + CanonicalFunction::ThreadYield + } + 0x2a => { + read_legacy_cancellation_byte(reader)?; + CanonicalFunction::ThreadSuspendThenResume + } + 0x2b => { + read_legacy_cancellation_byte(reader)?; + CanonicalFunction::ThreadYieldThenResume + } + 0x2c => { + read_legacy_cancellation_byte(reader)?; + CanonicalFunction::ThreadSuspendThenPromote + } + 0x2d => { + read_legacy_cancellation_byte(reader)?; + CanonicalFunction::ThreadYieldThenPromote + } 0x40 => CanonicalFunction::ThreadSpawnRef { func_ty_index: reader.read()?, }, @@ -462,6 +448,20 @@ fn read_opts(reader: &mut BinaryReader<'_>) -> Result> { .collect::>() } +fn read_legacy_cancellation_byte(reader: &mut BinaryReader<'_>) -> Result<()> { + Ok(match reader.read_u8()? { + 0x00 => {} + 0x01 => { + return reader.invalid_leading_byte( + 0x01, + "zero byte; this was historically accepted \ + as `cancellable` until WebAssembly/component-model#716", + ); + } + x => return reader.invalid_leading_byte(x, "zero byte"), + }) +} + impl<'a> FromReader<'a> for CanonicalOption { fn from_reader(reader: &mut BinaryReader<'a>) -> Result { Ok(match reader.read_u8()? { diff --git a/crates/wasmparser/src/validator/component.rs b/crates/wasmparser/src/validator/component.rs index cdead27495..b0b5ccac2a 100644 --- a/crates/wasmparser/src/validator/component.rs +++ b/crates/wasmparser/src/validator/component.rs @@ -1281,14 +1281,12 @@ impl ComponentState { } CanonicalFunction::ErrorContextDrop => self.error_context_drop(types, offset), CanonicalFunction::WaitableSetNew => self.waitable_set_new(types, offset), - CanonicalFunction::WaitableSetWait { - cancellable: _, - memory, - } => self.waitable_set_wait(memory, types, offset), - CanonicalFunction::WaitableSetPoll { - cancellable: _, - memory, - } => self.waitable_set_poll(memory, types, offset), + CanonicalFunction::WaitableSetWait { memory } => { + self.waitable_set_wait(memory, types, offset) + } + CanonicalFunction::WaitableSetPoll { memory } => { + self.waitable_set_poll(memory, types, offset) + } CanonicalFunction::WaitableSetDrop => self.waitable_set_drop(types, offset), CanonicalFunction::WaitableJoin => self.waitable_join(types, offset), CanonicalFunction::ThreadIndex => self.thread_index(types, offset), @@ -1297,21 +1295,19 @@ impl ComponentState { table_index, } => self.thread_new_indirect(func_ty_index, table_index, types, offset), CanonicalFunction::ThreadResumeLater => self.thread_resume_later(types, offset), - CanonicalFunction::ThreadSuspend { cancellable } => { - self.thread_suspend(cancellable, types, offset) - } - CanonicalFunction::ThreadYield { cancellable: _ } => self.thread_yield(types, offset), - CanonicalFunction::ThreadSuspendThenResume { cancellable } => { - self.thread_suspend_then_resume(cancellable, types, offset) + CanonicalFunction::ThreadSuspend => self.thread_suspend(types, offset), + CanonicalFunction::ThreadYield => self.thread_yield(types, offset), + CanonicalFunction::ThreadSuspendThenResume => { + self.thread_suspend_then_resume(types, offset) } - CanonicalFunction::ThreadYieldThenResume { cancellable } => { - self.thread_yield_then_resume(cancellable, types, offset) + CanonicalFunction::ThreadYieldThenResume => { + self.thread_yield_then_resume(types, offset) } - CanonicalFunction::ThreadSuspendThenPromote { cancellable } => { - self.thread_suspend_then_promote(cancellable, types, offset) + CanonicalFunction::ThreadSuspendThenPromote => { + self.thread_suspend_then_promote(types, offset) } - CanonicalFunction::ThreadYieldThenPromote { cancellable } => { - self.thread_yield_then_promote(cancellable, types, offset) + CanonicalFunction::ThreadYieldThenPromote => { + self.thread_yield_then_promote(types, offset) } } } @@ -2223,12 +2219,7 @@ impl ComponentState { Ok(()) } - fn thread_suspend( - &mut self, - _cancellable: bool, - types: &mut TypeAlloc, - offset: u64, - ) -> Result<()> { + fn thread_suspend(&mut self, types: &mut TypeAlloc, offset: u64) -> Result<()> { require_feature::cm_threading( self.features, "`thread.suspend` requires the component model threading feature", @@ -2251,12 +2242,7 @@ impl ComponentState { Ok(()) } - fn thread_suspend_then_resume( - &mut self, - _cancellable: bool, - types: &mut TypeAlloc, - offset: u64, - ) -> Result<()> { + fn thread_suspend_then_resume(&mut self, types: &mut TypeAlloc, offset: u64) -> Result<()> { require_feature::cm_threading( self.features, "`thread.suspend-then-resume` requires the component model threading feature", @@ -2268,12 +2254,7 @@ impl ComponentState { Ok(()) } - fn thread_yield_then_resume( - &mut self, - _cancellable: bool, - types: &mut TypeAlloc, - offset: u64, - ) -> Result<()> { + fn thread_yield_then_resume(&mut self, types: &mut TypeAlloc, offset: u64) -> Result<()> { require_feature::cm_threading( self.features, "`thread.yield-then-resume` requires the component model threading feature", @@ -2284,12 +2265,7 @@ impl ComponentState { Ok(()) } - fn thread_suspend_then_promote( - &mut self, - _cancellable: bool, - types: &mut TypeAlloc, - offset: u64, - ) -> Result<()> { + fn thread_suspend_then_promote(&mut self, types: &mut TypeAlloc, offset: u64) -> Result<()> { require_feature::cm_threading( self.features, "`thread.suspend-then-promote` requires the component model threading feature", @@ -2300,12 +2276,7 @@ impl ComponentState { Ok(()) } - fn thread_yield_then_promote( - &mut self, - _cancellable: bool, - types: &mut TypeAlloc, - offset: u64, - ) -> Result<()> { + fn thread_yield_then_promote(&mut self, types: &mut TypeAlloc, offset: u64) -> Result<()> { require_feature::cm_threading( self.features, "`thread.yield-then-promote` requires the component model threading feature", diff --git a/crates/wasmprinter/src/component.rs b/crates/wasmprinter/src/component.rs index d40d26c6db..62fd7f80c9 100644 --- a/crates/wasmprinter/src/component.rs +++ b/crates/wasmprinter/src/component.rs @@ -1012,13 +1012,8 @@ impl Printer<'_, '_> { Ok(()) })?; } - CanonicalFunction::ThreadYield { cancellable } => { - self.print_intrinsic(state, "canon thread.yield", &|me, _| { - if cancellable { - me.print_type_keyword(" cancellable")?; - } - Ok(()) - })?; + CanonicalFunction::ThreadYield => { + self.print_intrinsic(state, "canon thread.yield", &|_me, _| Ok(()))?; } CanonicalFunction::SubtaskDrop => { self.print_intrinsic(state, "canon subtask.drop", &|_, _| Ok(()))?; @@ -1139,27 +1134,15 @@ impl Printer<'_, '_> { CanonicalFunction::WaitableSetNew => { self.print_intrinsic(state, "canon waitable-set.new", &|_, _| Ok(()))?; } - CanonicalFunction::WaitableSetWait { - cancellable, - memory, - } => { + CanonicalFunction::WaitableSetWait { memory } => { self.print_intrinsic(state, "canon waitable-set.wait ", &|me, state| { - if cancellable { - me.result.write_str("cancellable ")?; - } me.start_group("memory ")?; me.print_idx(&state.core.memory_names, memory)?; me.end_group() })?; } - CanonicalFunction::WaitableSetPoll { - cancellable, - memory, - } => { + CanonicalFunction::WaitableSetPoll { memory } => { self.print_intrinsic(state, "canon waitable-set.poll ", &|me, state| { - if cancellable { - me.result.write_str("cancellable ")?; - } me.start_group("memory ")?; me.print_idx(&state.core.memory_names, memory)?; me.end_group() @@ -1187,43 +1170,28 @@ impl Printer<'_, '_> { CanonicalFunction::ThreadResumeLater => { self.print_intrinsic(state, "canon thread.resume-later", &|_, _| Ok(()))?; } - CanonicalFunction::ThreadSuspend { cancellable } => { - self.print_intrinsic(state, "canon thread.suspend", &|me, _| { - if cancellable { - me.result.write_str(" cancellable")?; - } - Ok(()) - })?; + CanonicalFunction::ThreadSuspend => { + self.print_intrinsic(state, "canon thread.suspend", &|_me, _| Ok(()))?; } - CanonicalFunction::ThreadSuspendThenResume { cancellable } => { - self.print_intrinsic(state, "canon thread.suspend-then-resume", &|me, _| { - if cancellable { - me.result.write_str(" cancellable")?; - } + CanonicalFunction::ThreadSuspendThenResume => { + self.print_intrinsic(state, "canon thread.suspend-then-resume", &|_me, _| { Ok(()) })?; } - CanonicalFunction::ThreadYieldThenResume { cancellable } => { - self.print_intrinsic(state, "canon thread.yield-then-resume", &|me, _| { - if cancellable { - me.result.write_str(" cancellable")?; - } - Ok(()) - })?; + CanonicalFunction::ThreadYieldThenResume => { + self.print_intrinsic( + state, + "canon thread.yield-then-resume", + &|_me, _| Ok(()), + )?; } - CanonicalFunction::ThreadSuspendThenPromote { cancellable } => { - self.print_intrinsic(state, "canon thread.suspend-then-promote", &|me, _| { - if cancellable { - me.result.write_str(" cancellable")?; - } + CanonicalFunction::ThreadSuspendThenPromote => { + self.print_intrinsic(state, "canon thread.suspend-then-promote", &|_me, _| { Ok(()) })?; } - CanonicalFunction::ThreadYieldThenPromote { cancellable } => { - self.print_intrinsic(state, "canon thread.yield-then-promote", &|me, _| { - if cancellable { - me.result.write_str(" cancellable")?; - } + CanonicalFunction::ThreadYieldThenPromote => { + self.print_intrinsic(state, "canon thread.yield-then-promote", &|_me, _| { Ok(()) })?; } diff --git a/crates/wast/src/component/binary.rs b/crates/wast/src/component/binary.rs index 3116893764..39d400b264 100644 --- a/crates/wast/src/component/binary.rs +++ b/crates/wast/src/component/binary.rs @@ -488,13 +488,11 @@ impl<'a> Encoder<'a> { } CoreFuncKind::WaitableSetWait(info) => { self.core_func_names.push(name); - self.funcs - .waitable_set_wait(info.async_, info.memory.idx.into()); + self.funcs.waitable_set_wait(info.memory.idx.into()); } CoreFuncKind::WaitableSetPoll(info) => { self.core_func_names.push(name); - self.funcs - .waitable_set_poll(info.async_, info.memory.idx.into()); + self.funcs.waitable_set_poll(info.memory.idx.into()); } CoreFuncKind::WaitableSetDrop => { self.core_func_names.push(name); @@ -517,29 +515,29 @@ impl<'a> Encoder<'a> { self.core_func_names.push(name); self.funcs.thread_resume_later(); } - CoreFuncKind::ThreadSuspend(info) => { + CoreFuncKind::ThreadSuspend => { self.core_func_names.push(name); - self.funcs.thread_suspend(info.cancellable); + self.funcs.thread_suspend(); } - CoreFuncKind::ThreadYield(info) => { + CoreFuncKind::ThreadYield => { self.core_func_names.push(name); - self.funcs.thread_yield(info.cancellable); + self.funcs.thread_yield(); } - CoreFuncKind::ThreadSuspendThenResume(info) => { + CoreFuncKind::ThreadSuspendThenResume => { self.core_func_names.push(name); - self.funcs.thread_suspend_then_resume(info.cancellable); + self.funcs.thread_suspend_then_resume(); } - CoreFuncKind::ThreadYieldThenResume(info) => { + CoreFuncKind::ThreadYieldThenResume => { self.core_func_names.push(name); - self.funcs.thread_yield_then_resume(info.cancellable); + self.funcs.thread_yield_then_resume(); } - CoreFuncKind::ThreadSuspendThenPromote(info) => { + CoreFuncKind::ThreadSuspendThenPromote => { self.core_func_names.push(name); - self.funcs.thread_suspend_then_promote(info.cancellable); + self.funcs.thread_suspend_then_promote(); } - CoreFuncKind::ThreadYieldThenPromote(info) => { + CoreFuncKind::ThreadYieldThenPromote => { self.core_func_names.push(name); - self.funcs.thread_yield_then_promote(info.cancellable); + self.funcs.thread_yield_then_promote(); } }, } diff --git a/crates/wast/src/component/func.rs b/crates/wast/src/component/func.rs index 1e38870b7a..2046692e2d 100644 --- a/crates/wast/src/component/func.rs +++ b/crates/wast/src/component/func.rs @@ -87,12 +87,12 @@ pub enum CoreFuncKind<'a> { ThreadIndex, ThreadNewIndirect(CanonThreadNewIndirect<'a>), ThreadResumeLater, - ThreadSuspend(CanonThreadSuspend), - ThreadYield(CanonThreadYield), - ThreadSuspendThenResume(CanonThreadSuspendThenResume), - ThreadYieldThenResume(CanonThreadYieldThenResume), - ThreadSuspendThenPromote(CanonThreadSuspendThenPromote), - ThreadYieldThenPromote(CanonThreadYieldThenPromote), + ThreadSuspend, + ThreadYield, + ThreadSuspendThenResume, + ThreadYieldThenResume, + ThreadSuspendThenPromote, + ThreadYieldThenPromote, } impl<'a> Parse<'a> for CoreFuncKind<'a> { @@ -208,17 +208,29 @@ impl<'a> CoreFuncKind<'a> { parser.parse::()?; Ok(CoreFuncKind::ThreadResumeLater) } else if l.peek::()? { - Ok(CoreFuncKind::ThreadSuspend(parser.parse()?)) + parser.parse::()?; + error_on_legacy_cancellable(parser)?; + Ok(CoreFuncKind::ThreadSuspend) } else if l.peek::()? { - Ok(CoreFuncKind::ThreadYield(parser.parse()?)) + parser.parse::()?; + error_on_legacy_cancellable(parser)?; + Ok(CoreFuncKind::ThreadYield) } else if l.peek::()? { - Ok(CoreFuncKind::ThreadSuspendThenResume(parser.parse()?)) + parser.parse::()?; + error_on_legacy_cancellable(parser)?; + Ok(CoreFuncKind::ThreadSuspendThenResume) } else if l.peek::()? { - Ok(CoreFuncKind::ThreadYieldThenResume(parser.parse()?)) + parser.parse::()?; + error_on_legacy_cancellable(parser)?; + Ok(CoreFuncKind::ThreadYieldThenResume) } else if l.peek::()? { - Ok(CoreFuncKind::ThreadSuspendThenPromote(parser.parse()?)) + parser.parse::()?; + error_on_legacy_cancellable(parser)?; + Ok(CoreFuncKind::ThreadSuspendThenPromote) } else if l.peek::()? { - Ok(CoreFuncKind::ThreadYieldThenPromote(parser.parse()?)) + parser.parse::()?; + error_on_legacy_cancellable(parser)?; + Ok(CoreFuncKind::ThreadYieldThenPromote) } else { Err(l.error()) } @@ -583,12 +595,19 @@ impl<'a> Parse<'a> for CanonTaskReturn<'a> { } } +fn error_on_legacy_cancellable(parser: Parser<'_>) -> Result<()> { + if parser.parse::>()?.is_some() { + return Err(parser.error( + "the `cancellable` option is no longer \ + supported after WebAssembly/component-model#716", + )); + } + Ok(()) +} + /// Information relating to the `waitable-set.wait` intrinsic. #[derive(Debug)] pub struct CanonWaitableSetWait<'a> { - /// If true, the component instance may be reentered during a call to this - /// intrinsic. - pub async_: bool, /// The memory to use when returning an event to the caller. pub memory: CoreItemRef<'a, kw::memory>, } @@ -596,22 +615,19 @@ pub struct CanonWaitableSetWait<'a> { impl<'a> Parse<'a> for CanonWaitableSetWait<'a> { fn parse(parser: Parser<'a>) -> Result { parser.parse::()?; - let async_ = parser.parse::>()?.is_some(); + error_on_legacy_cancellable(parser)?; let memory = parser.parens(|p| { let kind = p.parse::()?; parse_core_prefixed_contents(p, kind) })?; - Ok(Self { async_, memory }) + Ok(Self { memory }) } } /// Information relating to the `waitable-set.poll` intrinsic. #[derive(Debug)] pub struct CanonWaitableSetPoll<'a> { - /// If true, the component instance may be reentered during a call to this - /// intrinsic. - pub async_: bool, /// The memory to use when returning an event to the caller. pub memory: CoreItemRef<'a, kw::memory>, } @@ -619,30 +635,13 @@ pub struct CanonWaitableSetPoll<'a> { impl<'a> Parse<'a> for CanonWaitableSetPoll<'a> { fn parse(parser: Parser<'a>) -> Result { parser.parse::()?; - let async_ = parser.parse::>()?.is_some(); + error_on_legacy_cancellable(parser)?; let memory = parser.parens(|p| { let kind = p.parse::()?; parse_core_prefixed_contents(p, kind) })?; - Ok(Self { async_, memory }) - } -} - -/// Information relating to the `thread.yield` intrinsic. -#[derive(Debug)] -pub struct CanonThreadYield { - /// If true, the component instance may be reentered during a call to this - /// intrinsic. - pub cancellable: bool, -} - -impl<'a> Parse<'a> for CanonThreadYield { - fn parse(parser: Parser<'a>) -> Result { - parser.parse::()?; - let cancellable = parser.parse::>()?.is_some(); - - Ok(Self { cancellable }) + Ok(Self { memory }) } } @@ -981,76 +980,6 @@ impl<'a> Parse<'a> for CanonThreadNewIndirect<'a> { } } -/// Information relating to the `thread.suspend` intrinsic. -#[derive(Debug)] -pub struct CanonThreadSuspend { - /// Whether the thread can be cancelled while suspended at this point. - pub cancellable: bool, -} -impl<'a> Parse<'a> for CanonThreadSuspend { - fn parse(parser: Parser<'a>) -> Result { - parser.parse::()?; - let cancellable = parser.parse::>()?.is_some(); - Ok(Self { cancellable }) - } -} - -/// Information relating to the `thread.suspend-then-resume` intrinsic. -#[derive(Debug)] -pub struct CanonThreadSuspendThenResume { - /// Whether the thread can be cancelled while suspended at this point. - pub cancellable: bool, -} -impl<'a> Parse<'a> for CanonThreadSuspendThenResume { - fn parse(parser: Parser<'a>) -> Result { - parser.parse::()?; - let cancellable = parser.parse::>()?.is_some(); - Ok(Self { cancellable }) - } -} - -/// Information relating to the `thread.yield-then-resume` intrinsic. -#[derive(Debug)] -pub struct CanonThreadYieldThenResume { - /// Whether the thread can be cancelled while yielded at this point. - pub cancellable: bool, -} -impl<'a> Parse<'a> for CanonThreadYieldThenResume { - fn parse(parser: Parser<'a>) -> Result { - parser.parse::()?; - let cancellable = parser.parse::>()?.is_some(); - Ok(Self { cancellable }) - } -} - -/// Information relating to the `thread.suspend-then-resume` intrinsic. -#[derive(Debug)] -pub struct CanonThreadSuspendThenPromote { - /// Whether the thread can be cancelled while suspended at this point. - pub cancellable: bool, -} -impl<'a> Parse<'a> for CanonThreadSuspendThenPromote { - fn parse(parser: Parser<'a>) -> Result { - parser.parse::()?; - let cancellable = parser.parse::>()?.is_some(); - Ok(Self { cancellable }) - } -} - -/// Information relating to the `thread.yield-then-promote` intrinsic. -#[derive(Debug)] -pub struct CanonThreadYieldThenPromote { - /// Whether the thread can be cancelled while yielded at this point. - pub cancellable: bool, -} -impl<'a> Parse<'a> for CanonThreadYieldThenPromote { - fn parse(parser: Parser<'a>) -> Result { - parser.parse::()?; - let cancellable = parser.parse::>()?.is_some(); - Ok(Self { cancellable }) - } -} - #[derive(Debug)] /// Canonical ABI options. pub enum CanonOpt<'a> { diff --git a/crates/wast/src/component/resolve.rs b/crates/wast/src/component/resolve.rs index bf8dc91cc9..174115d961 100644 --- a/crates/wast/src/component/resolve.rs +++ b/crates/wast/src/component/resolve.rs @@ -565,12 +565,12 @@ impl<'a> Resolver<'a> { self.core_item_ref(&mut info.table)?; } CoreFuncKind::ThreadResumeLater => {} - CoreFuncKind::ThreadSuspend(_) => {} - CoreFuncKind::ThreadYield(_) => {} - CoreFuncKind::ThreadSuspendThenResume(_) => {} - CoreFuncKind::ThreadYieldThenResume(_) => {} - CoreFuncKind::ThreadSuspendThenPromote(_) => {} - CoreFuncKind::ThreadYieldThenPromote(_) => {} + CoreFuncKind::ThreadSuspend => {} + CoreFuncKind::ThreadYield => {} + CoreFuncKind::ThreadSuspendThenResume => {} + CoreFuncKind::ThreadYieldThenResume => {} + CoreFuncKind::ThreadSuspendThenPromote => {} + CoreFuncKind::ThreadYieldThenPromote => {} }, } diff --git a/crates/wit-component/src/encoding.rs b/crates/wit-component/src/encoding.rs index b5c08a048b..67439fff78 100644 --- a/crates/wit-component/src/encoding.rs +++ b/crates/wit-component/src/encoding.rs @@ -1490,12 +1490,12 @@ impl<'a> EncodingState<'a> { ReallocSite::AfterInstantiation, )?, - ShimKind::WaitableSetWait { cancellable } => self - .component - .waitable_set_wait(*cancellable, self.memory_index.unwrap()), - ShimKind::WaitableSetPoll { cancellable } => self - .component - .waitable_set_poll(*cancellable, self.memory_index.unwrap()), + ShimKind::WaitableSetWait => { + self.component.waitable_set_wait(self.memory_index.unwrap()) + } + ShimKind::WaitableSetPoll => { + self.component.waitable_set_poll(self.memory_index.unwrap()) + } ShimKind::ErrorContextNew { encoding } => self .component .error_context_new(shim.options.into_iter(*encoding, self.memory_index, None)?), @@ -1965,29 +1965,19 @@ impl<'a> EncodingState<'a> { let index = self.component.backpressure_dec(); Ok((ExportKind::Func, index)) } - Import::WaitableSetWait { cancellable } => { + Import::WaitableSetWait => { if let Some(memory) = self.memory_index { - let index = self.component.waitable_set_wait(*cancellable, memory); + let index = self.component.waitable_set_wait(memory); return Ok((ExportKind::Func, index)); } - Ok(self.materialize_shim_import( - shims, - &ShimKind::WaitableSetWait { - cancellable: *cancellable, - }, - )) + Ok(self.materialize_shim_import(shims, &ShimKind::WaitableSetWait)) } - Import::WaitableSetPoll { cancellable } => { + Import::WaitableSetPoll => { if let Some(memory) = self.memory_index { - let index = self.component.waitable_set_poll(*cancellable, memory); + let index = self.component.waitable_set_poll(memory); return Ok((ExportKind::Func, index)); } - Ok(self.materialize_shim_import( - shims, - &ShimKind::WaitableSetPoll { - cancellable: *cancellable, - }, - )) + Ok(self.materialize_shim_import(shims, &ShimKind::WaitableSetPoll)) } Import::SubtaskDrop => { let index = self.component.subtask_drop(); @@ -2159,28 +2149,28 @@ impl<'a> EncodingState<'a> { let index = self.component.thread_resume_later(); Ok((ExportKind::Func, index)) } - Import::ThreadSuspend { cancellable } => { - let index = self.component.thread_suspend(*cancellable); + Import::ThreadSuspend => { + let index = self.component.thread_suspend(); Ok((ExportKind::Func, index)) } - Import::ThreadYield { cancellable } => { - let index = self.component.thread_yield(*cancellable); + Import::ThreadYield => { + let index = self.component.thread_yield(); Ok((ExportKind::Func, index)) } - Import::ThreadSuspendThenResume { cancellable } => { - let index = self.component.thread_suspend_then_resume(*cancellable); + Import::ThreadSuspendThenResume => { + let index = self.component.thread_suspend_then_resume(); Ok((ExportKind::Func, index)) } - Import::ThreadYieldThenResume { cancellable } => { - let index = self.component.thread_yield_then_resume(*cancellable); + Import::ThreadYieldThenResume => { + let index = self.component.thread_yield_then_resume(); Ok((ExportKind::Func, index)) } - Import::ThreadSuspendThenPromote { cancellable } => { - let index = self.component.thread_suspend_then_promote(*cancellable); + Import::ThreadSuspendThenPromote => { + let index = self.component.thread_suspend_then_promote(); Ok((ExportKind::Func, index)) } - Import::ThreadYieldThenPromote { cancellable } => { - let index = self.component.thread_yield_then_promote(*cancellable); + Import::ThreadYieldThenPromote => { + let index = self.component.thread_yield_then_promote(); Ok((ExportKind::Func, index)) } } @@ -2515,11 +2505,11 @@ enum ShimKind<'a> { /// A shim used for the `waitable-set.wait` built-in function, which must /// refer to the core module instance's memory to which results will be /// written. - WaitableSetWait { cancellable: bool }, + WaitableSetWait, /// A shim used for the `waitable-set.poll` built-in function, which must /// refer to the core module instance's memory to which results will be /// written. - WaitableSetPoll { cancellable: bool }, + WaitableSetPoll, /// Shim for `task.return` to handle a reference to a `memory` which may TaskReturn { /// The interface (optional) that owns `func` below. If `None` then it's @@ -2766,7 +2756,7 @@ impl<'a> Shims<'a> { ); } - Import::WaitableSetWait { cancellable } => { + Import::WaitableSetWait => { if memory_available { continue; } @@ -2775,9 +2765,7 @@ impl<'a> Shims<'a> { name, debug_name: "waitable-set.wait".to_string(), options: RequiredOptions::empty(), - kind: ShimKind::WaitableSetWait { - cancellable: *cancellable, - }, + kind: ShimKind::WaitableSetWait, sig: WasmSignature { params: vec![WasmType::I32; 2], results: vec![WasmType::I32], @@ -2787,7 +2775,7 @@ impl<'a> Shims<'a> { }); } - Import::WaitableSetPoll { cancellable } => { + Import::WaitableSetPoll => { if memory_available { continue; } @@ -2796,9 +2784,7 @@ impl<'a> Shims<'a> { name, debug_name: "waitable-set.poll".to_string(), options: RequiredOptions::empty(), - kind: ShimKind::WaitableSetPoll { - cancellable: *cancellable, - }, + kind: ShimKind::WaitableSetPoll, sig: WasmSignature { params: vec![WasmType::I32; 2], results: vec![WasmType::I32], diff --git a/crates/wit-component/src/validation.rs b/crates/wit-component/src/validation.rs index 0b611b8748..713fce2f7a 100644 --- a/crates/wit-component/src/validation.rs +++ b/crates/wit-component/src/validation.rs @@ -325,14 +325,14 @@ pub enum Import { /// This allows the guest to wait for any pending calls to async-lowered /// imports and/or `stream` and `future` operations to complete without /// unwinding the current Wasm stack. - WaitableSetWait { cancellable: bool }, + WaitableSetWait, /// A `canon waitable.poll` intrinsic. /// /// This allows the guest to check whether any pending calls to /// async-lowered imports and/or `stream` and `future` operations have /// completed without unwinding the current Wasm stack and without blocking. - WaitableSetPoll { cancellable: bool }, + WaitableSetPoll, /// A `waitable-set.drop` intrinsic. WaitableSetDrop, @@ -460,22 +460,22 @@ pub enum Import { ThreadResumeLater, /// A `canon thread.suspend` intrinsic. - ThreadSuspend { cancellable: bool }, + ThreadSuspend, /// A `canon thread.yield` intrinsic. - ThreadYield { cancellable: bool }, + ThreadYield, /// A `canon thread.suspend-then-resume` intrinsic. - ThreadSuspendThenResume { cancellable: bool }, + ThreadSuspendThenResume, /// A `canon thread.yield-then-resume` intrinsic. - ThreadYieldThenResume { cancellable: bool }, + ThreadYieldThenResume, /// A `canon thread.suspend-then-promote` intrinsic. - ThreadSuspendThenPromote { cancellable: bool }, + ThreadSuspendThenPromote, /// A `canon thread.yield-then-promote` intrinsic. - ThreadYieldThenPromote { cancellable: bool }, + ThreadYieldThenPromote, } impl ImportMap { @@ -650,20 +650,16 @@ impl ImportMap { return Ok(Import::WaitableSetNew); } - if let Some((info, result_ty)) = names.waitable_set_wait(name) { + if let Some(result_ty) = names.waitable_set_wait(name) { let expected = FuncType::new([ValType::I32, result_ty], [ValType::I32]); validate_func_sig(name, &expected, ty)?; - return Ok(Import::WaitableSetWait { - cancellable: info.cancellable, - }); + return Ok(Import::WaitableSetWait); } - if let Some((info, result_ty)) = names.waitable_set_poll(name) { + if let Some(result_ty) = names.waitable_set_poll(name) { let expected = FuncType::new([ValType::I32, result_ty], [ValType::I32]); validate_func_sig(name, &expected, ty)?; - return Ok(Import::WaitableSetPoll { - cancellable: info.cancellable, - }); + return Ok(Import::WaitableSetPoll); } if names.waitable_set_drop(name) { @@ -729,47 +725,35 @@ impl ImportMap { validate_func_sig(name, &expected, ty)?; return Ok(Import::ThreadResumeLater); } - if let Some(info) = names.thread_suspend(name) { + if names.thread_suspend(name) { let expected = FuncType::new([], [ValType::I32]); validate_func_sig(name, &expected, ty)?; - return Ok(Import::ThreadSuspend { - cancellable: info.cancellable, - }); + return Ok(Import::ThreadSuspend); } - if let Some(info) = names.thread_yield(name) { + if names.thread_yield(name) { let expected = FuncType::new([], [ValType::I32]); validate_func_sig(name, &expected, ty)?; - return Ok(Import::ThreadYield { - cancellable: info.cancellable, - }); + return Ok(Import::ThreadYield); } - if let Some(info) = names.thread_suspend_then_resume(name) { + if names.thread_suspend_then_resume(name) { let expected = FuncType::new([ValType::I32], [ValType::I32]); validate_func_sig(name, &expected, ty)?; - return Ok(Import::ThreadSuspendThenResume { - cancellable: info.cancellable, - }); + return Ok(Import::ThreadSuspendThenResume); } - if let Some(info) = names.thread_yield_then_resume(name) { + if names.thread_yield_then_resume(name) { let expected = FuncType::new([ValType::I32], [ValType::I32]); validate_func_sig(name, &expected, ty)?; - return Ok(Import::ThreadYieldThenResume { - cancellable: info.cancellable, - }); + return Ok(Import::ThreadYieldThenResume); } - if let Some(info) = names.thread_suspend_then_promote(name) { + if names.thread_suspend_then_promote(name) { let expected = FuncType::new([ValType::I32], [ValType::I32]); validate_func_sig(name, &expected, ty)?; - return Ok(Import::ThreadSuspendThenPromote { - cancellable: info.cancellable, - }); + return Ok(Import::ThreadSuspendThenPromote); } - if let Some(info) = names.thread_yield_then_promote(name) { + if names.thread_yield_then_promote(name) { let expected = FuncType::new([ValType::I32], [ValType::I32]); validate_func_sig(name, &expected, ty)?; - return Ok(Import::ThreadYieldThenPromote { - cancellable: info.cancellable, - }); + return Ok(Import::ThreadYieldThenPromote); } let (key_name, abi) = names.world_key_name_and_abi(name); @@ -1556,13 +1540,6 @@ impl ExportMap { } } -/// A builtin that may be declared as cancellable. -struct MaybeCancellable { - #[allow(unused)] - inner: T, - cancellable: bool, -} - /// A builtin that may be declared as async-lowered. struct MaybeAsyncLowered { inner: T, @@ -1617,8 +1594,8 @@ trait NameMangling { fn backpressure_inc(&self, name: &str) -> bool; fn backpressure_dec(&self, name: &str) -> bool; fn waitable_set_new(&self, name: &str) -> bool; - fn waitable_set_wait(&self, name: &str) -> Option<(MaybeCancellable<()>, ValType)>; - fn waitable_set_poll(&self, name: &str) -> Option<(MaybeCancellable<()>, ValType)>; + fn waitable_set_wait(&self, name: &str) -> Option; + fn waitable_set_poll(&self, name: &str) -> Option; fn waitable_set_drop(&self, name: &str) -> bool; fn waitable_join(&self, name: &str) -> bool; fn subtask_drop(&self, name: &str) -> bool; @@ -1696,12 +1673,12 @@ trait NameMangling { fn thread_index(&self, name: &str) -> bool; fn thread_new_indirect(&self, name: &str) -> bool; fn thread_resume_later(&self, name: &str) -> bool; - fn thread_suspend(&self, name: &str) -> Option>; - fn thread_yield(&self, name: &str) -> Option>; - fn thread_suspend_then_resume(&self, name: &str) -> Option>; - fn thread_yield_then_resume(&self, name: &str) -> Option>; - fn thread_suspend_then_promote(&self, name: &str) -> Option>; - fn thread_yield_then_promote(&self, name: &str) -> Option>; + fn thread_suspend(&self, name: &str) -> bool; + fn thread_yield(&self, name: &str) -> bool; + fn thread_suspend_then_resume(&self, name: &str) -> bool; + fn thread_yield_then_resume(&self, name: &str) -> bool; + fn thread_suspend_then_promote(&self, name: &str) -> bool; + fn thread_yield_then_promote(&self, name: &str) -> bool; fn module_to_interface( &self, module: &str, @@ -1783,10 +1760,10 @@ impl NameMangling for Standard { fn waitable_set_new(&self, _name: &str) -> bool { false } - fn waitable_set_wait(&self, _name: &str) -> Option<(MaybeCancellable<()>, ValType)> { + fn waitable_set_wait(&self, _name: &str) -> Option { None } - fn waitable_set_poll(&self, _name: &str) -> Option<(MaybeCancellable<()>, ValType)> { + fn waitable_set_poll(&self, _name: &str) -> Option { None } fn waitable_set_drop(&self, _name: &str) -> bool { @@ -1834,23 +1811,23 @@ impl NameMangling for Standard { fn thread_resume_later(&self, _name: &str) -> bool { false } - fn thread_suspend(&self, _name: &str) -> Option> { - None + fn thread_suspend(&self, _name: &str) -> bool { + false } - fn thread_yield(&self, _name: &str) -> Option> { - None + fn thread_yield(&self, _name: &str) -> bool { + false } - fn thread_suspend_then_resume(&self, _name: &str) -> Option> { - None + fn thread_suspend_then_resume(&self, _name: &str) -> bool { + false } - fn thread_yield_then_resume(&self, _name: &str) -> Option> { - None + fn thread_yield_then_resume(&self, _name: &str) -> bool { + false } - fn thread_suspend_then_promote(&self, _name: &str) -> Option> { - None + fn thread_suspend_then_promote(&self, _name: &str) -> bool { + false } - fn thread_yield_then_promote(&self, _name: &str) -> Option> { - None + fn thread_yield_then_promote(&self, _name: &str) -> bool { + false } fn future_new( &self, @@ -2165,25 +2142,6 @@ impl Legacy { None } } - fn strip_cancellable_prefix<'a>(&self, name: &'a str) -> (bool, &'a str) { - name.strip_prefix("[cancellable]") - .map_or((false, name), |s| (true, s)) - } - fn match_with_cancellable_prefix( - &self, - name: &str, - expected: &str, - ) -> Option> { - let (cancellable, clean_name) = self.strip_cancellable_prefix(name); - if clean_name == expected { - Some(MaybeCancellable { - inner: (), - cancellable, - }) - } else { - None - } - } /// Matches a name with the given prefix and either no suffix (for backwards compat) or /// "-i32" or "-i64". @@ -2252,23 +2210,13 @@ impl NameMangling for Legacy { fn waitable_set_new(&self, name: &str) -> bool { name == "[waitable-set-new]" } - fn waitable_set_wait(&self, name: &str) -> Option<(MaybeCancellable<()>, ValType)> { - let (cancellable, clean_name) = self.strip_cancellable_prefix(name); - let mb_cancellable = MaybeCancellable { - inner: (), - cancellable, - }; - let result_ty = Legacy::match_with_optional_type_suffix(clean_name, "[waitable-set-wait")?; - Some((mb_cancellable, result_ty)) - } - fn waitable_set_poll(&self, name: &str) -> Option<(MaybeCancellable<()>, ValType)> { - let (cancellable, clean_name) = self.strip_cancellable_prefix(name); - let mb_cancellable = MaybeCancellable { - inner: (), - cancellable, - }; - let result_ty = Legacy::match_with_optional_type_suffix(clean_name, "[waitable-set-poll")?; - Some((mb_cancellable, result_ty)) + fn waitable_set_wait(&self, name: &str) -> Option { + let result_ty = Legacy::match_with_optional_type_suffix(name, "[waitable-set-wait")?; + Some(result_ty) + } + fn waitable_set_poll(&self, name: &str) -> Option { + let result_ty = Legacy::match_with_optional_type_suffix(name, "[waitable-set-poll")?; + Some(result_ty) } fn waitable_set_drop(&self, name: &str) -> bool { name == "[waitable-set-drop]" @@ -2326,23 +2274,23 @@ impl NameMangling for Legacy { fn thread_resume_later(&self, name: &str) -> bool { name == "[thread-resume-later]" } - fn thread_suspend(&self, name: &str) -> Option> { - self.match_with_cancellable_prefix(name, "[thread-suspend]") + fn thread_suspend(&self, name: &str) -> bool { + name == "[thread-suspend]" } - fn thread_yield(&self, name: &str) -> Option> { - self.match_with_cancellable_prefix(name, "[thread-yield]") + fn thread_yield(&self, name: &str) -> bool { + name == "[thread-yield]" } - fn thread_suspend_then_resume(&self, name: &str) -> Option> { - self.match_with_cancellable_prefix(name, "[thread-suspend-then-resume]") + fn thread_suspend_then_resume(&self, name: &str) -> bool { + name == "[thread-suspend-then-resume]" } - fn thread_yield_then_resume(&self, name: &str) -> Option> { - self.match_with_cancellable_prefix(name, "[thread-yield-then-resume]") + fn thread_yield_then_resume(&self, name: &str) -> bool { + name == "[thread-yield-then-resume]" } - fn thread_suspend_then_promote(&self, name: &str) -> Option> { - self.match_with_cancellable_prefix(name, "[thread-suspend-then-promote]") + fn thread_suspend_then_promote(&self, name: &str) -> bool { + name == "[thread-suspend-then-promote]" } - fn thread_yield_then_promote(&self, name: &str) -> Option> { - self.match_with_cancellable_prefix(name, "[thread-yield-then-promote]") + fn thread_yield_then_promote(&self, name: &str) -> bool { + name == "[thread-yield-then-promote]" } fn future_new(&self, lookup_context: &PayloadLookupContext, name: &str) -> Option { self.prefixed_payload(lookup_context, name, "[future-new-") diff --git a/tests/cli/component-model/async/stackful.wast b/tests/cli/component-model/async/stackful.wast index 0d5fe23f1b..6138b26ed2 100644 --- a/tests/cli/component-model/async/stackful.wast +++ b/tests/cli/component-model/async/stackful.wast @@ -7,7 +7,7 @@ (core module $m (import "" "waitable-set.wait" (func $waitable-set-wait (param i32 i32) (result i32))) ) - (core func $waitable-set-wait (canon waitable-set.wait cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-wait (canon waitable-set.wait (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.wait" (func $waitable-set-wait)))))) ) @@ -19,7 +19,7 @@ (core module $m (import "" "waitable-set.wait" (func $waitable-set-wait (param i32) (result i32))) ) - (core func $waitable-set-wait (canon waitable-set.wait cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-wait (canon waitable-set.wait (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.wait" (func $waitable-set-wait)))))) ) "type mismatch for export `waitable-set.wait` of module instantiation argument ``" @@ -32,7 +32,7 @@ (core module $m (import "" "waitable-set.poll" (func $waitable-set-poll (param i32 i32) (result i32))) ) - (core func $waitable-set-poll (canon waitable-set.poll cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-poll (canon waitable-set.poll (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.poll" (func $waitable-set-poll)))))) ) @@ -44,7 +44,7 @@ (core module $m (import "" "waitable-set.poll" (func $waitable-set-poll (param i32) (result i32))) ) - (core func $waitable-set-poll (canon waitable-set.poll cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-poll (canon waitable-set.poll (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.poll" (func $waitable-set-poll)))))) ) "type mismatch for export `waitable-set.poll` of module instantiation argument ``" @@ -55,7 +55,7 @@ (core module $m (import "" "thread.yield" (func $thread.yield (result i32))) ) - (core func $thread.yield (canon thread.yield cancellable)) + (core func $thread.yield (canon thread.yield)) (core instance $i (instantiate $m (with "" (instance (export "thread.yield" (func $thread.yield)))))) ) @@ -65,7 +65,7 @@ (core module $m (import "" "thread.yield" (func $thread.yield (param i32) (result i32))) ) - (core func $thread.yield (canon thread.yield cancellable)) + (core func $thread.yield (canon thread.yield)) (core instance $i (instantiate $m (with "" (instance (export "thread.yield" (func $thread.yield)))))) ) "type mismatch for export `thread.yield` of module instantiation argument ``" diff --git a/tests/cli/component-model/async/task-builtins.wast b/tests/cli/component-model/async/task-builtins.wast index 1379229e12..0821b33ed3 100644 --- a/tests/cli/component-model/async/task-builtins.wast +++ b/tests/cli/component-model/async/task-builtins.wast @@ -155,7 +155,7 @@ (core module $m (import "" "waitable-set.wait" (func $waitable-set-wait (param i32 i32) (result i32))) ) - (core func $waitable-set-wait (canon waitable-set.wait cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-wait (canon waitable-set.wait (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.wait" (func $waitable-set-wait)))))) ) @@ -175,7 +175,7 @@ (core module $m (import "" "waitable-set.poll" (func $waitable-set-poll (param i32 i32) (result i32))) ) - (core func $waitable-set-poll (canon waitable-set.poll cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-poll (canon waitable-set.poll (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.poll" (func $waitable-set-poll)))))) ) @@ -299,7 +299,7 @@ (core module $m (import "" "thread.yield" (func $thread.yield (result i32))) ) - (core func $thread.yield (canon thread.yield cancellable)) + (core func $thread.yield (canon thread.yield)) (core instance $i (instantiate $m (with "" (instance (export "thread.yield" (func $thread.yield)))))) ) diff --git a/tests/cli/component-model/async/threading.wast b/tests/cli/component-model/async/threading.wast index 5d9c1c8124..edd3bcc8fa 100644 --- a/tests/cli/component-model/async/threading.wast +++ b/tests/cli/component-model/async/threading.wast @@ -249,28 +249,18 @@ (core func (canon thread.suspend)) (canon thread.suspend (core func)) - (core func (canon thread.suspend cancellable)) - (canon thread.suspend cancellable (core func)) (core func (canon thread.suspend-then-resume)) (canon thread.suspend-then-resume (core func)) - (core func (canon thread.suspend-then-resume cancellable)) - (canon thread.suspend-then-resume cancellable (core func)) (core func (canon thread.yield-then-resume)) (canon thread.yield-then-resume (core func)) - (core func (canon thread.yield-then-resume cancellable)) - (canon thread.yield-then-resume cancellable (core func)) (core func (canon thread.suspend-then-promote)) (canon thread.suspend-then-promote (core func)) - (core func (canon thread.suspend-then-promote cancellable)) - (canon thread.suspend-then-promote cancellable (core func)) (core func (canon thread.yield-then-promote)) (canon thread.yield-then-promote (core func)) - (core func (canon thread.yield-then-promote cancellable)) - (canon thread.yield-then-promote cancellable (core func)) ) (component diff --git a/tests/cli/component-model/memory64/waitable-set.wast b/tests/cli/component-model/memory64/waitable-set.wast index 9fc524d571..49c292c29f 100644 --- a/tests/cli/component-model/memory64/waitable-set.wast +++ b/tests/cli/component-model/memory64/waitable-set.wast @@ -8,7 +8,7 @@ (core module $m (import "" "waitable-set.wait" (func $waitable-set-wait (param i32 i64) (result i32))) ) - (core func $waitable-set-wait (canon waitable-set.wait cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-wait (canon waitable-set.wait (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.wait" (func $waitable-set-wait)))))) ) @@ -19,7 +19,7 @@ (core module $m (import "" "waitable-set.wait" (func $waitable-set-wait (param i32 i64) (result i32))) ) - (core func $waitable-set-wait (canon waitable-set.wait cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-wait (canon waitable-set.wait (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.wait" (func $waitable-set-wait)))))) ) "type mismatch for export `waitable-set.wait`" @@ -32,7 +32,7 @@ (core module $m (import "" "waitable-set.wait" (func $waitable-set-wait (param i32 i32) (result i32))) ) - (core func $waitable-set-wait (canon waitable-set.wait cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-wait (canon waitable-set.wait (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.wait" (func $waitable-set-wait)))))) ) "type mismatch for export `waitable-set.wait`" @@ -47,7 +47,7 @@ (core module $m (import "" "waitable-set.poll" (func $waitable-set-poll (param i32 i64) (result i32))) ) - (core func $waitable-set-poll (canon waitable-set.poll cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-poll (canon waitable-set.poll (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.poll" (func $waitable-set-poll)))))) ) @@ -58,7 +58,7 @@ (core module $m (import "" "waitable-set.poll" (func $waitable-set-poll (param i32 i64) (result i32))) ) - (core func $waitable-set-poll (canon waitable-set.poll cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-poll (canon waitable-set.poll (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.poll" (func $waitable-set-poll)))))) ) "type mismatch for export `waitable-set.poll`" @@ -71,8 +71,8 @@ (core module $m (import "" "waitable-set.poll" (func $waitable-set-poll (param i32 i32) (result i32))) ) - (core func $waitable-set-poll (canon waitable-set.poll cancellable (memory (core memory $libc "memory")))) + (core func $waitable-set-poll (canon waitable-set.poll (memory (core memory $libc "memory")))) (core instance $i (instantiate $m (with "" (instance (export "waitable-set.poll" (func $waitable-set-poll)))))) ) "type mismatch for export `waitable-set.poll`" -) \ No newline at end of file +) diff --git a/tests/cli/missing-features/component-model/async-stackful.wast b/tests/cli/missing-features/component-model/async-stackful.wast index 72dd15eb1c..4c5e7f2789 100644 --- a/tests/cli/missing-features/component-model/async-stackful.wast +++ b/tests/cli/missing-features/component-model/async-stackful.wast @@ -11,34 +11,3 @@ ) ) "requires the component model async stackful feature") - -;; waitable-set.wait cancellable -(component - (core module $libc (memory (export "memory") 1)) - (core instance $libc (instantiate $libc)) - (core func (canon waitable-set.wait cancellable (memory (core memory $libc "memory")))) -) - -(component - (core module $libc (memory (export "memory") 1)) - (core instance $libc (instantiate $libc)) - (core func (canon waitable-set.wait (memory (core memory $libc "memory")))) -) - -;; waitable-set.poll cancellable -(component - (core module $libc (memory (export "memory") 1)) - (core instance $libc (instantiate $libc)) - (core func (canon waitable-set.poll cancellable (memory (core memory $libc "memory")))) -) - -(component - (core module $libc (memory (export "memory") 1)) - (core instance $libc (instantiate $libc)) - (core func (canon waitable-set.poll (memory (core memory $libc "memory")))) -) - -;; thread.yield -(component (core func (canon thread.yield cancellable))) - -(component (core func (canon thread.yield))) diff --git a/tests/cli/spec/components/async/cancellable.wast b/tests/cli/spec/components/async/cancellable.wast index 7fbfc01457..ae6b2db844 100644 --- a/tests/cli/spec/components/async/cancellable.wast +++ b/tests/cli/spec/components/async/cancellable.wast @@ -1,4 +1,4 @@ -;; RUN: wast \ +;; FAIL: wast \ ;; --assert default \ ;; --snapshot tests/snapshots \ ;; --ignore-error-messages \ diff --git a/tests/cli/spec/components/async/cancellable.wast.stderr b/tests/cli/spec/components/async/cancellable.wast.stderr new file mode 100644 index 0000000000..3691be09e0 --- /dev/null +++ b/tests/cli/spec/components/async/cancellable.wast.stderr @@ -0,0 +1,5 @@ +error: the `cancellable` option is no longer supported after WebAssembly/component-model#716 + --> tests/component-model/test/async/cancellable.wast:142:42 + | + 142 | (canon waitable-set.wait cancellable (memory (core memory $memory "mem")) (core func $waitable-set.wait-cancellable)) + | ^ diff --git a/tests/cli/spec/components/binary/binary.wast b/tests/cli/spec/components/binary/binary.wast index 33ebefd6c1..71b255184b 100644 --- a/tests/cli/spec/components/binary/binary.wast +++ b/tests/cli/spec/components/binary/binary.wast @@ -1,4 +1,4 @@ -;; RUN: wast \ +;; FAIL: wast \ ;; --assert default \ ;; --assert permissive \ ;; --snapshot tests/snapshots \ diff --git a/tests/cli/spec/components/binary/binary.wast.stderr b/tests/cli/spec/components/binary/binary.wast.stderr new file mode 100644 index 0000000000..d9a13b91d4 --- /dev/null +++ b/tests/cli/spec/components/binary/binary.wast.stderr @@ -0,0 +1,10 @@ +error: 1 test failures in tests/component-model/test/binary/binary.wast: + +-------------------------------- + +failed directive on tests/component-model/test/binary/binary.wast:974:2 + +Caused by: + 0: failed testing wasm binary produced by `wast` + 1: wasm isn't valid + 2: invalid leading byte (0x1) for zero byte; this was historically accepted as `cancellable` until WebAssembly/component-model#716 (at offset 0x192) diff --git a/tests/snapshots/cli/component-model/async/stackful.wast/0.print b/tests/snapshots/cli/component-model/async/stackful.wast/0.print index 30cc2c0977..80b1d0fe8b 100644 --- a/tests/snapshots/cli/component-model/async/stackful.wast/0.print +++ b/tests/snapshots/cli/component-model/async/stackful.wast/0.print @@ -9,7 +9,7 @@ (import "" "waitable-set.wait" (func $waitable-set-wait (;0;) (type 0))) ) (alias core export $libc "memory" (core memory (;0;))) - (core func $waitable-set-wait (;0;) (canon waitable-set.wait cancellable (memory 0))) + (core func $waitable-set-wait (;0;) (canon waitable-set.wait (memory 0))) (core instance (;1;) (export "waitable-set.wait" (func $waitable-set-wait)) ) diff --git a/tests/snapshots/cli/component-model/async/stackful.wast/2.print b/tests/snapshots/cli/component-model/async/stackful.wast/2.print index 4690399a01..77a366d4e4 100644 --- a/tests/snapshots/cli/component-model/async/stackful.wast/2.print +++ b/tests/snapshots/cli/component-model/async/stackful.wast/2.print @@ -9,7 +9,7 @@ (import "" "waitable-set.poll" (func $waitable-set-poll (;0;) (type 0))) ) (alias core export $libc "memory" (core memory (;0;))) - (core func $waitable-set-poll (;0;) (canon waitable-set.poll cancellable (memory 0))) + (core func $waitable-set-poll (;0;) (canon waitable-set.poll (memory 0))) (core instance (;1;) (export "waitable-set.poll" (func $waitable-set-poll)) ) diff --git a/tests/snapshots/cli/component-model/async/stackful.wast/4.print b/tests/snapshots/cli/component-model/async/stackful.wast/4.print index f8845497a5..d2d2a6a265 100644 --- a/tests/snapshots/cli/component-model/async/stackful.wast/4.print +++ b/tests/snapshots/cli/component-model/async/stackful.wast/4.print @@ -3,7 +3,7 @@ (type (;0;) (func (result i32))) (import "" "thread.yield" (func $thread.yield (;0;) (type 0))) ) - (core func $thread.yield (;0;) (canon thread.yield cancellable)) + (core func $thread.yield (;0;) (canon thread.yield)) (core instance (;0;) (export "thread.yield" (func $thread.yield)) ) diff --git a/tests/snapshots/cli/component-model/async/task-builtins.wast/16.print b/tests/snapshots/cli/component-model/async/task-builtins.wast/16.print index 30cc2c0977..80b1d0fe8b 100644 --- a/tests/snapshots/cli/component-model/async/task-builtins.wast/16.print +++ b/tests/snapshots/cli/component-model/async/task-builtins.wast/16.print @@ -9,7 +9,7 @@ (import "" "waitable-set.wait" (func $waitable-set-wait (;0;) (type 0))) ) (alias core export $libc "memory" (core memory (;0;))) - (core func $waitable-set-wait (;0;) (canon waitable-set.wait cancellable (memory 0))) + (core func $waitable-set-wait (;0;) (canon waitable-set.wait (memory 0))) (core instance (;1;) (export "waitable-set.wait" (func $waitable-set-wait)) ) diff --git a/tests/snapshots/cli/component-model/async/task-builtins.wast/18.print b/tests/snapshots/cli/component-model/async/task-builtins.wast/18.print index 4690399a01..77a366d4e4 100644 --- a/tests/snapshots/cli/component-model/async/task-builtins.wast/18.print +++ b/tests/snapshots/cli/component-model/async/task-builtins.wast/18.print @@ -9,7 +9,7 @@ (import "" "waitable-set.poll" (func $waitable-set-poll (;0;) (type 0))) ) (alias core export $libc "memory" (core memory (;0;))) - (core func $waitable-set-poll (;0;) (canon waitable-set.poll cancellable (memory 0))) + (core func $waitable-set-poll (;0;) (canon waitable-set.poll (memory 0))) (core instance (;1;) (export "waitable-set.poll" (func $waitable-set-poll)) ) diff --git a/tests/snapshots/cli/component-model/async/task-builtins.wast/30.print b/tests/snapshots/cli/component-model/async/task-builtins.wast/30.print index f8845497a5..d2d2a6a265 100644 --- a/tests/snapshots/cli/component-model/async/task-builtins.wast/30.print +++ b/tests/snapshots/cli/component-model/async/task-builtins.wast/30.print @@ -3,7 +3,7 @@ (type (;0;) (func (result i32))) (import "" "thread.yield" (func $thread.yield (;0;) (type 0))) ) - (core func $thread.yield (;0;) (canon thread.yield cancellable)) + (core func $thread.yield (;0;) (canon thread.yield)) (core instance (;0;) (export "thread.yield" (func $thread.yield)) ) diff --git a/tests/snapshots/cli/component-model/async/threading.wast.json b/tests/snapshots/cli/component-model/async/threading.wast.json index 8d3777d935..31a9d9188e 100644 --- a/tests/snapshots/cli/component-model/async/threading.wast.json +++ b/tests/snapshots/cli/component-model/async/threading.wast.json @@ -174,7 +174,7 @@ }, { "type": "module", - "line": 276, + "line": 266, "filename": "threading.26.wasm", "module_type": "binary" } diff --git a/tests/snapshots/cli/component-model/async/threading.wast/25.print b/tests/snapshots/cli/component-model/async/threading.wast/25.print index c9bc6aca7f..fe94534756 100644 --- a/tests/snapshots/cli/component-model/async/threading.wast/25.print +++ b/tests/snapshots/cli/component-model/async/threading.wast/25.print @@ -16,22 +16,12 @@ (core func (;7;) (canon thread.resume-later)) (core func (;8;) (canon thread.suspend)) (core func (;9;) (canon thread.suspend)) - (core func (;10;) (canon thread.suspend cancellable)) - (core func (;11;) (canon thread.suspend cancellable)) - (core func (;12;) (canon thread.suspend-then-resume)) - (core func (;13;) (canon thread.suspend-then-resume)) - (core func (;14;) (canon thread.suspend-then-resume cancellable)) - (core func (;15;) (canon thread.suspend-then-resume cancellable)) - (core func (;16;) (canon thread.yield-then-resume)) - (core func (;17;) (canon thread.yield-then-resume)) - (core func (;18;) (canon thread.yield-then-resume cancellable)) - (core func (;19;) (canon thread.yield-then-resume cancellable)) - (core func (;20;) (canon thread.suspend-then-promote)) - (core func (;21;) (canon thread.suspend-then-promote)) - (core func (;22;) (canon thread.suspend-then-promote cancellable)) - (core func (;23;) (canon thread.suspend-then-promote cancellable)) - (core func (;24;) (canon thread.yield-then-promote)) - (core func (;25;) (canon thread.yield-then-promote)) - (core func (;26;) (canon thread.yield-then-promote cancellable)) - (core func (;27;) (canon thread.yield-then-promote cancellable)) + (core func (;10;) (canon thread.suspend-then-resume)) + (core func (;11;) (canon thread.suspend-then-resume)) + (core func (;12;) (canon thread.yield-then-resume)) + (core func (;13;) (canon thread.yield-then-resume)) + (core func (;14;) (canon thread.suspend-then-promote)) + (core func (;15;) (canon thread.suspend-then-promote)) + (core func (;16;) (canon thread.yield-then-promote)) + (core func (;17;) (canon thread.yield-then-promote)) ) diff --git a/tests/snapshots/cli/component-model/memory64/waitable-set.wast/0.print b/tests/snapshots/cli/component-model/memory64/waitable-set.wast/0.print index c32d30e5e7..a698a76845 100644 --- a/tests/snapshots/cli/component-model/memory64/waitable-set.wast/0.print +++ b/tests/snapshots/cli/component-model/memory64/waitable-set.wast/0.print @@ -9,7 +9,7 @@ (import "" "waitable-set.wait" (func $waitable-set-wait (;0;) (type 0))) ) (alias core export $libc "memory" (core memory (;0;))) - (core func $waitable-set-wait (;0;) (canon waitable-set.wait cancellable (memory 0))) + (core func $waitable-set-wait (;0;) (canon waitable-set.wait (memory 0))) (core instance (;1;) (export "waitable-set.wait" (func $waitable-set-wait)) ) diff --git a/tests/snapshots/cli/component-model/memory64/waitable-set.wast/3.print b/tests/snapshots/cli/component-model/memory64/waitable-set.wast/3.print index 849528e4bb..b9cdb9bd9f 100644 --- a/tests/snapshots/cli/component-model/memory64/waitable-set.wast/3.print +++ b/tests/snapshots/cli/component-model/memory64/waitable-set.wast/3.print @@ -9,7 +9,7 @@ (import "" "waitable-set.poll" (func $waitable-set-poll (;0;) (type 0))) ) (alias core export $libc "memory" (core memory (;0;))) - (core func $waitable-set-poll (;0;) (canon waitable-set.poll cancellable (memory 0))) + (core func $waitable-set-poll (;0;) (canon waitable-set.poll (memory 0))) (core instance (;1;) (export "waitable-set.poll" (func $waitable-set-poll)) ) diff --git a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast.json b/tests/snapshots/cli/missing-features/component-model/async-stackful.wast.json index 713ef92ac3..ff5807bfbe 100644 --- a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast.json +++ b/tests/snapshots/cli/missing-features/component-model/async-stackful.wast.json @@ -7,42 +7,6 @@ "filename": "async-stackful.0.wasm", "module_type": "binary", "text": "requires the component model async stackful feature" - }, - { - "type": "module", - "line": 16, - "filename": "async-stackful.1.wasm", - "module_type": "binary" - }, - { - "type": "module", - "line": 22, - "filename": "async-stackful.2.wasm", - "module_type": "binary" - }, - { - "type": "module", - "line": 29, - "filename": "async-stackful.3.wasm", - "module_type": "binary" - }, - { - "type": "module", - "line": 35, - "filename": "async-stackful.4.wasm", - "module_type": "binary" - }, - { - "type": "module", - "line": 42, - "filename": "async-stackful.5.wasm", - "module_type": "binary" - }, - { - "type": "module", - "line": 44, - "filename": "async-stackful.6.wasm", - "module_type": "binary" } ] } \ No newline at end of file diff --git a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/1.print b/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/1.print deleted file mode 100644 index 5e4959f83c..0000000000 --- a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/1.print +++ /dev/null @@ -1,9 +0,0 @@ -(component - (core module $libc (;0;) - (memory (;0;) 1) - (export "memory" (memory 0)) - ) - (core instance $libc (;0;) (instantiate $libc)) - (alias core export $libc "memory" (core memory (;0;))) - (core func (;0;) (canon waitable-set.wait cancellable (memory 0))) -) diff --git a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/2.print b/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/2.print deleted file mode 100644 index 96c65f93d7..0000000000 --- a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/2.print +++ /dev/null @@ -1,9 +0,0 @@ -(component - (core module $libc (;0;) - (memory (;0;) 1) - (export "memory" (memory 0)) - ) - (core instance $libc (;0;) (instantiate $libc)) - (alias core export $libc "memory" (core memory (;0;))) - (core func (;0;) (canon waitable-set.wait (memory 0))) -) diff --git a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/3.print b/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/3.print deleted file mode 100644 index 5f8c6997d2..0000000000 --- a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/3.print +++ /dev/null @@ -1,9 +0,0 @@ -(component - (core module $libc (;0;) - (memory (;0;) 1) - (export "memory" (memory 0)) - ) - (core instance $libc (;0;) (instantiate $libc)) - (alias core export $libc "memory" (core memory (;0;))) - (core func (;0;) (canon waitable-set.poll cancellable (memory 0))) -) diff --git a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/4.print b/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/4.print deleted file mode 100644 index a4322a5d8c..0000000000 --- a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/4.print +++ /dev/null @@ -1,9 +0,0 @@ -(component - (core module $libc (;0;) - (memory (;0;) 1) - (export "memory" (memory 0)) - ) - (core instance $libc (;0;) (instantiate $libc)) - (alias core export $libc "memory" (core memory (;0;))) - (core func (;0;) (canon waitable-set.poll (memory 0))) -) diff --git a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/5.print b/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/5.print deleted file mode 100644 index 8defbe1420..0000000000 --- a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/5.print +++ /dev/null @@ -1,3 +0,0 @@ -(component - (core func (;0;) (canon thread.yield cancellable)) -) diff --git a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/6.print b/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/6.print deleted file mode 100644 index a1d9c7a10c..0000000000 --- a/tests/snapshots/cli/missing-features/component-model/async-stackful.wast/6.print +++ /dev/null @@ -1,3 +0,0 @@ -(component - (core func (;0;) (canon thread.yield)) -) diff --git a/tests/snapshots/component-model/test/async/cancellable.wast.json b/tests/snapshots/component-model/test/async/cancellable.wast.json deleted file mode 100644 index 129c9cb611..0000000000 --- a/tests/snapshots/component-model/test/async/cancellable.wast.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "source_filename": "tests/component-model/test/async/cancellable.wast", - "commands": [ - { - "type": "module", - "line": 16, - "filename": "cancellable.0.wasm", - "module_type": "binary" - }, - { - "type": "assert_return", - "line": 404, - "action": { - "type": "invoke", - "field": "run", - "args": [] - }, - "expected": [ - { - "type": "u32", - "value": "42" - } - ] - } - ] -} \ No newline at end of file diff --git a/tests/snapshots/component-model/test/async/cancellable.wast/0.print b/tests/snapshots/component-model/test/async/cancellable.wast/0.print deleted file mode 100644 index e78db8f1d1..0000000000 --- a/tests/snapshots/component-model/test/async/cancellable.wast/0.print +++ /dev/null @@ -1,631 +0,0 @@ -(component - (component $C (;0;) - (core module $Memory (;0;) - (memory (;0;) 1) - (export "mem" (memory 0)) - ) - (core instance $memory (;0;) (instantiate $Memory)) - (core module $CM (;1;) - (type (;0;) (func)) - (type (;1;) (func (param i32 i32) (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (result i32))) - (type (;4;) (func (param i32) (result i32))) - (type (;5;) (func (param i32 i32 i32) (result i32))) - (import "" "mem" (memory (;0;) 1)) - (import "" "task.cancel" (func $task.cancel (;0;) (type 0))) - (import "" "future.read" (func $future.read (;1;) (type 1))) - (import "" "waitable.join" (func $waitable.join (;2;) (type 2))) - (import "" "waitable-set.new" (func $waitable-set.new (;3;) (type 3))) - (import "" "waitable-set.wait-cancellable" (func $waitable-set.wait-cancellable (;4;) (type 1))) - (import "" "waitable-set.wait" (func $waitable-set.wait (;5;) (type 1))) - (import "" "waitable-set.poll-cancellable" (func $waitable-set.poll-cancellable (;6;) (type 1))) - (import "" "thread.yield-cancellable" (func $thread.yield-cancellable (;7;) (type 3))) - (import "" "thread.yield" (func $thread.yield (;8;) (type 3))) - (export "wait-cancel" (func $wait-cancel)) - (export "yield-cancel" (func $yield-cancel)) - (export "poll-cancel-pending" (func $poll-cancel-pending)) - (export "yield-cancel-pending" (func $yield-cancel-pending)) - (export "pending-survives-nc-yield" (func $pending-survives-nc-yield)) - (export "unreachable-cb" (func 14)) - (func $wait-cancel (;9;) (type 3) (result i32) - (local $event_code i32) (local $ws i32) - call $waitable-set.new - local.set $ws - local.get $ws - i32.const 0 - call $waitable-set.wait-cancellable - local.set $event_code - local.get $event_code - i32.const 6 - i32.ne - if ;; label = @1 - unreachable - end - call $task.cancel - i32.const 0 - ) - (func $yield-cancel (;10;) (type 3) (result i32) - loop $again - call $thread.yield-cancellable - i32.eqz - br_if $again - end - call $task.cancel - i32.const 0 - ) - (func $poll-cancel-pending (;11;) (type 4) (param $futr i32) (result i32) - (local $ws i32) (local $ret i32) (local $event_code i32) - call $waitable-set.new - local.set $ws - local.get $futr - i32.const 0 - call $future.read - local.set $ret - i32.const -1 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - local.get $futr - local.get $ws - call $waitable.join - local.get $ws - i32.const 0 - call $waitable-set.wait - local.set $event_code - i32.const 4 - local.get $event_code - i32.ne - if ;; label = @1 - unreachable - end - local.get $ws - i32.const 0 - call $waitable-set.poll-cancellable - local.set $event_code - i32.const 6 - local.get $event_code - i32.ne - if ;; label = @1 - unreachable - end - call $task.cancel - i32.const 0 - ) - (func $yield-cancel-pending (;12;) (type 4) (param $futr i32) (result i32) - (local $ws i32) (local $ret i32) (local $event_code i32) - call $waitable-set.new - local.set $ws - local.get $futr - i32.const 0 - call $future.read - local.set $ret - i32.const -1 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - local.get $futr - local.get $ws - call $waitable.join - local.get $ws - i32.const 0 - call $waitable-set.wait - local.set $event_code - i32.const 4 - local.get $event_code - i32.ne - if ;; label = @1 - unreachable - end - call $thread.yield-cancellable - local.set $ret - i32.const 1 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - call $task.cancel - i32.const 0 - ) - (func $pending-survives-nc-yield (;13;) (type 4) (param $futr i32) (result i32) - (local $ws i32) (local $ret i32) (local $event_code i32) - call $waitable-set.new - local.set $ws - local.get $futr - i32.const 0 - call $future.read - local.set $ret - i32.const -1 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - local.get $futr - local.get $ws - call $waitable.join - local.get $ws - i32.const 0 - call $waitable-set.wait - local.set $event_code - i32.const 4 - local.get $event_code - i32.ne - if ;; label = @1 - unreachable - end - call $thread.yield - local.set $ret - i32.const 0 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - call $thread.yield-cancellable - local.set $ret - i32.const 1 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - call $task.cancel - i32.const 0 - ) - (func (;14;) (type 5) (param i32 i32 i32) (result i32) - unreachable - ) - ) - (type $FT (;0;) (future)) - (core func $task.cancel (;0;) (canon task.cancel)) - (alias core export $memory "mem" (core memory (;0;))) - (core func $future.read (;1;) (canon future.read $FT async (memory 0))) - (core func $waitable.join (;2;) (canon waitable.join)) - (core func $waitable-set.new (;3;) (canon waitable-set.new)) - (alias core export $memory "mem" (core memory (;1;))) - (core func $waitable-set.wait-cancellable (;4;) (canon waitable-set.wait cancellable (memory 1))) - (alias core export $memory "mem" (core memory (;2;))) - (core func $waitable-set.wait (;5;) (canon waitable-set.wait (memory 2))) - (alias core export $memory "mem" (core memory (;3;))) - (core func $waitable-set.poll-cancellable (;6;) (canon waitable-set.poll cancellable (memory 3))) - (core func $thread.yield-cancellable (;7;) (canon thread.yield cancellable)) - (core func $thread.yield (;8;) (canon thread.yield)) - (alias core export $memory "mem" (core memory (;4;))) - (core instance (;1;) - (export "mem" (memory 4)) - (export "task.cancel" (func $task.cancel)) - (export "future.read" (func $future.read)) - (export "waitable.join" (func $waitable.join)) - (export "waitable-set.new" (func $waitable-set.new)) - (export "waitable-set.wait-cancellable" (func $waitable-set.wait-cancellable)) - (export "waitable-set.wait" (func $waitable-set.wait)) - (export "waitable-set.poll-cancellable" (func $waitable-set.poll-cancellable)) - (export "thread.yield-cancellable" (func $thread.yield-cancellable)) - (export "thread.yield" (func $thread.yield)) - ) - (core instance $cm (;2;) (instantiate $CM - (with "" (instance 1)) - ) - ) - (type (;1;) (func async (result u32))) - (alias core export $cm "wait-cancel" (core func (;9;))) - (alias core export $cm "unreachable-cb" (core func (;10;))) - (func (;0;) (type 1) (canon lift (core func 9) async (callback 10))) - (type (;2;) (func async (result u32))) - (alias core export $cm "yield-cancel" (core func (;11;))) - (alias core export $cm "unreachable-cb" (core func (;12;))) - (func (;1;) (type 2) (canon lift (core func 11) async (callback 12))) - (type (;3;) (func async (param "fut" $FT) (result u32))) - (alias core export $cm "poll-cancel-pending" (core func (;13;))) - (alias core export $cm "unreachable-cb" (core func (;14;))) - (func (;2;) (type 3) (canon lift (core func 13) async (callback 14))) - (type (;4;) (func async (param "fut" $FT) (result u32))) - (alias core export $cm "yield-cancel-pending" (core func (;15;))) - (alias core export $cm "unreachable-cb" (core func (;16;))) - (func (;3;) (type 4) (canon lift (core func 15) async (callback 16))) - (type (;5;) (func async (param "fut" $FT) (result u32))) - (alias core export $cm "pending-survives-nc-yield" (core func (;17;))) - (alias core export $cm "unreachable-cb" (core func (;18;))) - (func (;4;) (type 5) (canon lift (core func 17) async (callback 18))) - (export (;5;) "wait-cancel" (func 0)) - (export (;6;) "yield-cancel" (func 1)) - (export (;7;) "poll-cancel-pending" (func 2)) - (export (;8;) "yield-cancel-pending" (func 3)) - (export (;9;) "pending-survives-nc-yield" (func 4)) - ) - (component $D (;1;) - (type $FT (;0;) (future)) - (type (;1;) (func async (result u32))) - (import "wait-cancel" (func $wait-cancel (;0;) (type 1))) - (type (;2;) (func async (result u32))) - (import "yield-cancel" (func $yield-cancel (;1;) (type 2))) - (type (;3;) (func async (param "fut" $FT) (result u32))) - (import "poll-cancel-pending" (func $poll-cancel-pending (;2;) (type 3))) - (type (;4;) (func async (param "fut" $FT) (result u32))) - (import "yield-cancel-pending" (func $yield-cancel-pending (;3;) (type 4))) - (type (;5;) (func async (param "fut" $FT) (result u32))) - (import "pending-survives-nc-yield" (func $pending-survives-nc-yield (;4;) (type 5))) - (core module $Memory (;0;) - (memory (;0;) 1) - (export "mem" (memory 0)) - ) - (core instance $memory (;0;) (instantiate $Memory)) - (core module $DM (;1;) - (type (;0;) (func (param i32) (result i32))) - (type (;1;) (func (param i32))) - (type (;2;) (func (result i64))) - (type (;3;) (func (param i32 i32) (result i32))) - (type (;4;) (func (param i32 i32))) - (type (;5;) (func (result i32))) - (import "" "mem" (memory (;0;) 1)) - (import "" "subtask.cancel" (func $subtask.cancel (;0;) (type 0))) - (import "" "subtask.drop" (func $subtask.drop (;1;) (type 1))) - (import "" "future.new" (func $future.new (;2;) (type 2))) - (import "" "future.write" (func $future.write (;3;) (type 3))) - (import "" "waitable.join" (func $waitable.join (;4;) (type 4))) - (import "" "waitable-set.new" (func $waitable-set.new (;5;) (type 5))) - (import "" "waitable-set.wait" (func $waitable-set.wait (;6;) (type 3))) - (import "" "wait-cancel" (func $wait-cancel (;7;) (type 0))) - (import "" "yield-cancel" (func $yield-cancel (;8;) (type 0))) - (import "" "poll-cancel-pending" (func $poll-cancel-pending (;9;) (type 3))) - (import "" "yield-cancel-pending" (func $yield-cancel-pending (;10;) (type 3))) - (import "" "pending-survives-nc-yield" (func $pending-survives-nc-yield (;11;) (type 3))) - (export "run" (func $run)) - (func $run (;12;) (type 5) (result i32) - (local $ret i32) (local $ret64 i64) (local $retp i32) (local $retp2 i32) (local $subtask i32) (local $event_code i32) (local $futr i32) (local $futw i32) (local $ws i32) - i32.const 4 - local.set $retp - local.get $retp - call $wait-cancel - local.set $ret - i32.const 1 - local.get $ret - i32.const 15 - i32.and - i32.ne - if ;; label = @1 - unreachable - end - local.get $ret - i32.const 4 - i32.shr_u - local.set $subtask - local.get $subtask - call $subtask.cancel - local.set $ret - i32.const 4 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - local.get $subtask - call $subtask.drop - local.get $retp - call $yield-cancel - local.set $ret - i32.const 1 - local.get $ret - i32.const 15 - i32.and - i32.ne - if ;; label = @1 - unreachable - end - local.get $ret - i32.const 4 - i32.shr_u - local.set $subtask - local.get $subtask - call $subtask.cancel - local.set $ret - i32.const 4 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - local.get $subtask - call $subtask.drop - call $future.new - local.set $ret64 - local.get $ret64 - i32.wrap_i64 - local.set $futr - local.get $ret64 - i64.const 32 - i64.shr_u - i32.wrap_i64 - local.set $futw - i32.const 4 - local.set $retp - i32.const 8 - local.set $retp2 - local.get $futr - local.get $retp - call $poll-cancel-pending - local.set $ret - i32.const 1 - local.get $ret - i32.const 15 - i32.and - i32.ne - if ;; label = @1 - unreachable - end - local.get $ret - i32.const 4 - i32.shr_u - local.set $subtask - local.get $subtask - call $subtask.cancel - local.set $ret - i32.const -1 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - local.get $futw - i32.const 0 - call $future.write - local.set $ret - i32.const 0 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - call $waitable-set.new - local.set $ws - local.get $subtask - local.get $ws - call $waitable.join - local.get $ws - local.get $retp2 - call $waitable-set.wait - local.set $event_code - i32.const 1 - local.get $event_code - i32.ne - if ;; label = @1 - unreachable - end - local.get $subtask - local.get $retp2 - i32.load - i32.ne - if ;; label = @1 - unreachable - end - i32.const 4 - local.get $retp2 - i32.load offset=4 - i32.ne - if ;; label = @1 - unreachable - end - local.get $subtask - call $subtask.drop - call $future.new - local.set $ret64 - local.get $ret64 - i32.wrap_i64 - local.set $futr - local.get $ret64 - i64.const 32 - i64.shr_u - i32.wrap_i64 - local.set $futw - local.get $futr - local.get $retp - call $yield-cancel-pending - local.set $ret - i32.const 1 - local.get $ret - i32.const 15 - i32.and - i32.ne - if ;; label = @1 - unreachable - end - local.get $ret - i32.const 4 - i32.shr_u - local.set $subtask - local.get $subtask - call $subtask.cancel - local.set $ret - i32.const -1 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - local.get $futw - i32.const 0 - call $future.write - local.set $ret - i32.const 0 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - call $waitable-set.new - local.set $ws - local.get $subtask - local.get $ws - call $waitable.join - local.get $ws - local.get $retp2 - call $waitable-set.wait - local.set $event_code - i32.const 1 - local.get $event_code - i32.ne - if ;; label = @1 - unreachable - end - local.get $subtask - local.get $retp2 - i32.load - i32.ne - if ;; label = @1 - unreachable - end - i32.const 4 - local.get $retp2 - i32.load offset=4 - i32.ne - if ;; label = @1 - unreachable - end - local.get $subtask - call $subtask.drop - call $future.new - local.set $ret64 - local.get $ret64 - i32.wrap_i64 - local.set $futr - local.get $ret64 - i64.const 32 - i64.shr_u - i32.wrap_i64 - local.set $futw - local.get $futr - local.get $retp - call $pending-survives-nc-yield - local.set $ret - i32.const 1 - local.get $ret - i32.const 15 - i32.and - i32.ne - if ;; label = @1 - unreachable - end - local.get $ret - i32.const 4 - i32.shr_u - local.set $subtask - local.get $subtask - call $subtask.cancel - local.set $ret - i32.const -1 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - local.get $futw - i32.const 0 - call $future.write - local.set $ret - i32.const 0 - local.get $ret - i32.ne - if ;; label = @1 - unreachable - end - call $waitable-set.new - local.set $ws - local.get $subtask - local.get $ws - call $waitable.join - local.get $ws - local.get $retp2 - call $waitable-set.wait - local.set $event_code - i32.const 1 - local.get $event_code - i32.ne - if ;; label = @1 - unreachable - end - local.get $subtask - local.get $retp2 - i32.load - i32.ne - if ;; label = @1 - unreachable - end - i32.const 4 - local.get $retp2 - i32.load offset=4 - i32.ne - if ;; label = @1 - unreachable - end - local.get $subtask - call $subtask.drop - i32.const 42 - ) - ) - (core func $subtask.cancel (;0;) (canon subtask.cancel async)) - (core func $subtask.drop (;1;) (canon subtask.drop)) - (core func $future.new (;2;) (canon future.new $FT)) - (alias core export $memory "mem" (core memory (;0;))) - (core func $future.write (;3;) (canon future.write $FT async (memory 0))) - (core func $waitable.join (;4;) (canon waitable.join)) - (core func $waitable-set.new (;5;) (canon waitable-set.new)) - (alias core export $memory "mem" (core memory (;1;))) - (core func $waitable-set.wait (;6;) (canon waitable-set.wait (memory 1))) - (alias core export $memory "mem" (core memory (;2;))) - (core func $wait-cancel' (;7;) (canon lower (func $wait-cancel) async (memory 2))) - (alias core export $memory "mem" (core memory (;3;))) - (core func $yield-cancel' (;8;) (canon lower (func $yield-cancel) async (memory 3))) - (alias core export $memory "mem" (core memory (;4;))) - (core func $poll-cancel-pending' (;9;) (canon lower (func $poll-cancel-pending) async (memory 4))) - (alias core export $memory "mem" (core memory (;5;))) - (core func $yield-cancel-pending' (;10;) (canon lower (func $yield-cancel-pending) async (memory 5))) - (alias core export $memory "mem" (core memory (;6;))) - (core func $pending-survives-nc-yield' (;11;) (canon lower (func $pending-survives-nc-yield) async (memory 6))) - (alias core export $memory "mem" (core memory (;7;))) - (core instance (;1;) - (export "mem" (memory 7)) - (export "subtask.cancel" (func $subtask.cancel)) - (export "subtask.drop" (func $subtask.drop)) - (export "future.new" (func $future.new)) - (export "future.write" (func $future.write)) - (export "waitable.join" (func $waitable.join)) - (export "waitable-set.new" (func $waitable-set.new)) - (export "waitable-set.wait" (func $waitable-set.wait)) - (export "wait-cancel" (func $wait-cancel')) - (export "yield-cancel" (func $yield-cancel')) - (export "poll-cancel-pending" (func $poll-cancel-pending')) - (export "yield-cancel-pending" (func $yield-cancel-pending')) - (export "pending-survives-nc-yield" (func $pending-survives-nc-yield')) - ) - (core instance $dm (;2;) (instantiate $DM - (with "" (instance 1)) - ) - ) - (type (;6;) (func async (result u32))) - (alias core export $dm "run" (core func (;12;))) - (func (;5;) (type 6) (canon lift (core func 12))) - (export (;6;) "run" (func 5)) - ) - (instance $c (;0;) (instantiate $C)) - (alias export $c "wait-cancel" (func (;0;))) - (alias export $c "yield-cancel" (func (;1;))) - (alias export $c "poll-cancel-pending" (func (;2;))) - (alias export $c "yield-cancel-pending" (func (;3;))) - (alias export $c "pending-survives-nc-yield" (func (;4;))) - (instance $d (;1;) (instantiate $D - (with "wait-cancel" (func 0)) - (with "yield-cancel" (func 1)) - (with "poll-cancel-pending" (func 2)) - (with "yield-cancel-pending" (func 3)) - (with "pending-survives-nc-yield" (func 4)) - ) - ) - (alias export $d "run" (func (;5;))) - (export (;6;) "run" (func 5)) -) diff --git a/tests/snapshots/component-model/test/binary/binary.wast/92.print b/tests/snapshots/component-model/test/binary/binary.wast/92.print deleted file mode 100644 index 1c5be18940..0000000000 --- a/tests/snapshots/component-model/test/binary/binary.wast/92.print +++ /dev/null @@ -1,97 +0,0 @@ -(component - (core module (;0;) - (type (;0;) (func)) - (type (;1;) (func (param i32 i32))) - (type (;2;) (func (result i32))) - (type (;3;) (func (param i32 i32 i32) (result i32))) - (type (;4;) (func (param i32))) - (type (;5;) (func (param i32 i32 i32 i32) (result i32))) - (table (;0;) 1 funcref) - (memory (;0;) 1) - (global (;0;) i32 i32.const 0) - (export "f" (func 0)) - (export "g" (func 1)) - (export "run" (func 2)) - (export "cb" (func 3)) - (export "dtor" (func 4)) - (export "realloc" (func 5)) - (export "mem" (memory 0)) - (export "tbl" (table 0)) - (export "glob" (global 0)) - (func (;0;) (type 0)) - (func (;1;) (type 1) (param i32 i32)) - (func (;2;) (type 2) (result i32) - i32.const 0 - ) - (func (;3;) (type 3) (param i32 i32 i32) (result i32) - i32.const 0 - ) - (func (;4;) (type 4) (param i32)) - (func (;5;) (type 5) (param i32 i32 i32 i32) (result i32) - i32.const 0 - ) - ) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "f" (core func (;0;))) - (alias core export 0 "g" (core func (;1;))) - (alias core export 0 "run" (core func (;2;))) - (alias core export 0 "cb" (core func (;3;))) - (alias core export 0 "dtor" (core func (;4;))) - (alias core export 0 "realloc" (core func (;5;))) - (alias core export 0 "mem" (core memory (;0;))) - (alias core export 0 "tbl" (core table (;0;))) - (type (;0;) (func)) - (type (;1;) (func (param "p" string))) - (type (;2;) (func async)) - (type (;3;) (stream u8)) - (type (;4;) (future)) - (type (;5;) (resource (rep i32) (dtor 4))) - (core type (;0;) (func (param i32))) - (func (;0;) (type 0) (canon lift (core func 0))) - (func (;1;) (type 1) (canon lift (core func 1) string-encoding=utf8 (memory 0) (realloc 5))) - (func (;2;) (type 2) (canon lift (core func 2) async (callback 3))) - (func (;3;) (type 0) (canon lift (core func 0) (post-return 0))) - (core func (;6;) (canon lower (func 0) string-encoding=utf16)) - (core func (;7;) (canon lower (func 0) string-encoding=latin1+utf16)) - (core func (;8;) (canon resource.new 5)) - (core func (;9;) (canon resource.drop 5)) - (core func (;10;) (canon resource.rep 5)) - (core func (;11;) (canon backpressure.inc)) - (core func (;12;) (canon backpressure.dec)) - (core func (;13;) (canon task.return)) - (core func (;14;) (canon task.return (result u32))) - (core func (;15;) (canon task.cancel)) - (core func (;16;) (canon context.get i32 0)) - (core func (;17;) (canon context.set i32 0)) - (core func (;18;) (canon subtask.cancel)) - (core func (;19;) (canon subtask.cancel async)) - (core func (;20;) (canon subtask.drop)) - (core func (;21;) (canon stream.new 3)) - (core func (;22;) (canon stream.read 3 (memory 0) (realloc 5))) - (core func (;23;) (canon stream.write 3 (memory 0) (realloc 5))) - (core func (;24;) (canon stream.cancel-read 3)) - (core func (;25;) (canon stream.cancel-write 3 async)) - (core func (;26;) (canon stream.drop-readable 3)) - (core func (;27;) (canon stream.drop-writable 3)) - (core func (;28;) (canon future.new 4)) - (core func (;29;) (canon future.read 4 (memory 0) (realloc 5))) - (core func (;30;) (canon future.write 4 (memory 0) (realloc 5))) - (core func (;31;) (canon future.cancel-read 4)) - (core func (;32;) (canon future.cancel-write 4 async)) - (core func (;33;) (canon future.drop-readable 4)) - (core func (;34;) (canon future.drop-writable 4)) - (core func (;35;) (canon waitable-set.new)) - (core func (;36;) (canon waitable-set.wait (memory 0))) - (core func (;37;) (canon waitable-set.poll cancellable (memory 0))) - (core func (;38;) (canon waitable-set.drop)) - (core func (;39;) (canon waitable.join)) - (core func (;40;) (canon thread.index)) - (core func (;41;) (canon thread.new-indirect 0 0)) - (core func (;42;) (canon thread.resume-later)) - (core func (;43;) (canon thread.suspend)) - (core func (;44;) (canon thread.yield cancellable)) - (core func (;45;) (canon thread.suspend-then-resume)) - (core func (;46;) (canon thread.yield-then-resume)) - (core func (;47;) (canon thread.suspend-then-promote)) - (core func (;48;) (canon thread.yield-then-promote cancellable)) -)