Skip to content

Commit

Permalink
threads: use 0x24 to encode thread.spawn_indirect
Browse files Browse the repository at this point in the history
This encoding change is necessary due to recent additions to the
component model; see [bytecodealliance#447].

[bytecodealliance#447]: WebAssembly/component-model#447
  • Loading branch information
abrown committed Feb 7, 2025
1 parent 7739259 commit 29f14d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/wasm-encoder/src/component/canonicals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmparser/src/readers/component/canonicals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 29f14d9

Please sign in to comment.