Skip to content

Fix a number of shared-everything-threads issues - #2828

Open
alexcrichton wants to merge 2 commits into
bytecodealliance:mainfrom
alexcrichton:shared-everything-threads-updates
Open

alexcrichton wants to merge 2 commits into
bytecodealliance:mainfrom
alexcrichton:shared-everything-threads-updates

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit fixes a number of implementation issues with the shared-everything-threads proposal and syncs it with the current upstream specification which has changed a bit since this was all originally implemented. The changes here are:

  • Component model thread.spawn-ref and related builtins have an immediate indicating whether they create a shared function or not.
  • The encoding of RMW instructions now uses the same encoding scheme as the acquire-release-atomics proposal.
  • The opcode of ref.i31_shared was adjusted.
  • With custom descriptors enabled the shared bit for descriptors must match the type being described.
  • Shared functions now require all operands on the operand stack to be shared.
  • Shared functions now require all locals to be shared.
  • Shared functions now require referenced memories to be shared.
  • Shared functions now require referenced tables to be shared.
  • Shared functions now require referenced functions to be shared.
  • The "expected" type for cmpxchg instructions is now correctly typed as an eqref or shared version, not the type of the item in question.
  • Polymorphic instructions like call_ref now accept both shared and unshared references.

This commit fixes a number of implementation issues with the
shared-everything-threads proposal and syncs it with the current
upstream specification which has changed a bit since this was all
originally implemented. The changes here are:

* Component model `thread.spawn-ref` and related builtins have an
  immediate indicating whether they create a `shared` function or not.
* The encoding of RMW instructions now uses the same encoding scheme as
  the acquire-release-atomics proposal.
* The opcode of `ref.i31_shared` was adjusted.
* With custom descriptors enabled the `shared` bit for descriptors must
  match the type being described.
* Shared functions now require all operands on the operand stack to be
  shared.
* Shared functions now require all locals to be shared.
* Shared functions now require referenced memories to be shared.
* Shared functions now require referenced tables to be shared.
* Shared functions now require referenced functions to be shared.
* The "expected" type for cmpxchg instructions is now correctly typed as
  an `eqref` or shared version, not the type of the item in question.
* Polymorphic instructions like `call_ref` now accept both shared and
  unshared references.
@alexcrichton
alexcrichton requested a review from a team as a code owner November 16, 2026 23:15
@alexcrichton
alexcrichton requested review from dicej and removed request for a team November 16, 2026 23:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant