From 29f14d9f6655024872719b1684783f44438e9dfb Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 7 Feb 2025 11:00:09 -0800 Subject: [PATCH] threads: use 0x24 to encode `thread.spawn_indirect` This encoding change is necessary due to recent additions to the component model; see [#447]. [#447]: https://github.com/WebAssembly/component-model/pull/447 --- crates/wasm-encoder/src/component/canonicals.rs | 2 +- crates/wasmparser/src/readers/component/canonicals.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/wasm-encoder/src/component/canonicals.rs b/crates/wasm-encoder/src/component/canonicals.rs index b3493ddee6..04682c1ba6 100644 --- a/crates/wasm-encoder/src/component/canonicals.rs +++ b/crates/wasm-encoder/src/component/canonicals.rs @@ -170,7 +170,7 @@ impl CanonicalFunctionSection { /// Defines a function which will spawn a new thread by invoking a shared /// function indirectly through a `funcref` table. pub fn thread_spawn_indirect(&mut self, table_index: u32) -> &mut Self { - self.bytes.push(0x07); + self.bytes.push(0x24); table_index.encode(&mut self.bytes); self.num_added += 1; self diff --git a/crates/wasmparser/src/readers/component/canonicals.rs b/crates/wasmparser/src/readers/component/canonicals.rs index 5b95e982a9..d93f2f83d5 100644 --- a/crates/wasmparser/src/readers/component/canonicals.rs +++ b/crates/wasmparser/src/readers/component/canonicals.rs @@ -285,7 +285,7 @@ impl<'a> FromReader<'a> for CanonicalFunction { 0x05 => CanonicalFunction::ThreadSpawn { func_ty_index: reader.read()?, }, - 0x07 => CanonicalFunction::ThreadSpawnIndirect { + 0x24 => CanonicalFunction::ThreadSpawnIndirect { table_index: reader.read()?, }, 0x06 => CanonicalFunction::ThreadHwConcurrency,