Add thread.spawn_indirect#447
Merged
Merged
Conversation
abrown
commented
Feb 7, 2025
abrown
added a commit
to abrown/wasm-tools
that referenced
this pull request
Feb 7, 2025
This encoding change is necessary due to recent additions to the component model; see [bytecodealliance#447]. [bytecodealliance#447]: WebAssembly/component-model#447
abrown
added a commit
to abrown/wasm-tools
that referenced
this pull request
Feb 7, 2025
[bytecodealliance#447] tries to make the built-in naming a bit more consistent; this change propagates that here. [bytecodealliance#447]: WebAssembly/component-model#447
abrown
added a commit
to abrown/wasm-tools
that referenced
this pull request
Feb 7, 2025
This encoding change is necessary due to recent additions to the component model; see [bytecodealliance#447]. [bytecodealliance#447]: WebAssembly/component-model#447
abrown
added a commit
to abrown/wasm-tools
that referenced
this pull request
Feb 7, 2025
[bytecodealliance#447] tries to make the built-in naming a bit more consistent; this change propagates that here. [bytecodealliance#447]: WebAssembly/component-model#447
lukewagner
reviewed
Feb 17, 2025
lukewagner
left a comment
Member
There was a problem hiding this comment.
Looks generally good. One initial suggestion:
This change codifies the conclusions we arrived to in [WebAssembly#89]. It adds a new way to spawn threads, `thread.spawn_indirect`, which retrieves the thread start function from a table. This prompted me to rename `thread.spawn` to `thread.spawn_ref`. [WebAssembly#89]: WebAssembly/shared-everything-threads#89
a69f22e to
903cdb1
Compare
abrown
commented
Feb 27, 2025
Contributor
Author
|
@lukewagner, I had to rebase due to some conflicts but the follow-on commits should have the changes we discussed. |
lukewagner
approved these changes
Feb 28, 2025
lukewagner
left a comment
Member
There was a problem hiding this comment.
Great, thanks! This looks good to me with these suggestions:
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
abrown
commented
Feb 28, 2025
lukewagner
reviewed
Feb 28, 2025
Co-authored-by: Luke Wagner <mail@lukewagner.name>
Co-authored-by: Luke Wagner <mail@lukewagner.name>
rossberg
reviewed
Mar 5, 2025
Comment on lines
+3834
to
+3835
| * `$tbl` must refer to a table with type `(table (ref null (shared func)) | ||
| shared)` |
Member
There was a problem hiding this comment.
The table type doesn't seem to follow any syntax defined in the proposal. More importantly, we have subtyping. So I think this ought to say:
* `$tbl` must refer to a shared table whose element type matches `(ref null (shared func))`
abrown
added a commit
to abrown/component-model
that referenced
this pull request
Mar 5, 2025
This uses the language suggested [here] to document the table type needed for the `thread.spawn_indirect` canonical builtin. [here]: WebAssembly#447 (comment)
lukewagner
pushed a commit
that referenced
this pull request
Mar 5, 2025
This uses the language suggested [here] to document the table type needed for the `thread.spawn_indirect` canonical builtin. [here]: #447 (comment)
abrown
added a commit
to abrown/wasm-tools
that referenced
this pull request
Mar 17, 2025
[bytecodealliance#447] tries to make the built-in naming a bit more consistent; this change propagates that here. [bytecodealliance#447]: WebAssembly/component-model#447
abrown
added a commit
to abrown/wasm-tools
that referenced
this pull request
Mar 17, 2025
This encoding change is necessary due to recent additions to the component model; see [bytecodealliance#447]. [bytecodealliance#447]: WebAssembly/component-model#447
abrown
added a commit
to abrown/wasm-tools
that referenced
this pull request
Mar 17, 2025
[bytecodealliance#447] tries to make the built-in naming a bit more consistent; this change propagates that here. [bytecodealliance#447]: WebAssembly/component-model#447
abrown
added a commit
to abrown/wasm-tools
that referenced
this pull request
Mar 17, 2025
This encoding change is necessary due to recent additions to the component model; see [bytecodealliance#447]. [bytecodealliance#447]: WebAssembly/component-model#447
github-merge-queue Bot
pushed a commit
to bytecodealliance/wasm-tools
that referenced
this pull request
Mar 17, 2025
* threads: add `thread.spawn_indirect` As discussed in [#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`. [#89]: WebAssembly/shared-everything-threads#89 * threads: rename `thread.spawn` to `thread.spawn_ref` [#447] tries to make the built-in naming a bit more consistent; this change propagates that here. [#447]: WebAssembly/component-model#447 * threads: move `thread.*` canonical opcodes to `0x40+` This encoding change is necessary due to recent additions to the component model; see [#447]. [#447]: WebAssembly/component-model#447 * threads: add function types to `thread.spawn_indirect` Initially I implemented `thread.spawn_indirect` without the ability to check the type of the function to spawn out of an abundance of caution (see the implementation issues described in [#89]). In the process of writing out the specification, we convinced ourselves that these problems should not apply to `thread.spawn_indirect`. This change adds the function type index necessary for doing some extra validation of `thread.spawn_indirect` and adds some tests related to this. One unimplemented TODO is what to do about shared tables: technically, the table used by a `thread.spawn_indirect` should be shared but we have so far prevented this in the component model; this can be resolved later, though. [#89]: WebAssembly/shared-everything-threads#89 * review: simplify WAST parsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change codifies the conclusions we arrived to in #89. It adds a new way to spawn threads,
thread.spawn_indirect, which retrieves the thread start function from a table. This prompted me to renamethread.spawntothread.spawn_ref.