-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
threads: add thread.spawn_indirect
#2042
base: main
Are you sure you want to change the base?
Conversation
As discussed in [bytecodealliance#89], this adds support for a new intrinsic, `thread.spawn_indirect`. This new operation would allow spawning a shared function stored in a table via a table index. This leaves some future work undone: - `thread.spawn` could/should be renamed to `thread.spawn_ref` - `thread.spawn_indirect` could/should take the encoding byte from `thread.hw_concurrency`--swap `0x07` for `0x06` - importantly, `thread.spawn_indirect` should gain a field indicating which type to expect in the indirect table; due to current limitations in `wasm-tools`, the locations to check once this is possible are marked with `TODO: spawn indirect types`. [bytecodealliance#89]: WebAssembly/shared-everything-threads#89
This encoding change is necessary due to recent additions to the component model; see [bytecodealliance#447]. [bytecodealliance#447]: WebAssembly/component-model#447
[bytecodealliance#447] tries to make the built-in naming a bit more consistent; this change propagates that here. [bytecodealliance#447]: WebAssembly/component-model#447
cfc0969
to
7d7f530
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! Mind adding a test as well for using a table of the wrong type? (e.g. a non-shared funcref or a shared-externref)
0x24 => CanonicalFunction::ThreadSpawnIndirect { | ||
table_index: reader.read()?, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense logically to put here but for easily scanning this list mind moving it down to the bottom so it's more clear where the "holes" are in decoding?
// Eventually this should resolve the specific type associated | ||
// with this canonical function, e.g., | ||
// `self.resolve_type_use(&mut info.ty)?;` (TODO: spawn indirect | ||
// types). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a comment to flag this. This looks though like it's a TODO at the spec-level, right? (as opposed to just exclusively the implementation here)
This propagates the upstream spec changes to the component model in #447 here. See commit messages for more details.