Skip to content

Reserve handle index 0 in the component model#7661

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:reserve-index-zero
Feb 21, 2024
Merged

Reserve handle index 0 in the component model#7661
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:reserve-index-zero

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit updates the allocation scheme for resources in the component model to start at 1 instead of 0 when communicating with components. This is an implementation of WebAssembly/component-model#284.

While this broke a number of tests we have this shouldn't actually break any components in practice. The broken tests were all overly-precise in their assertions and error messages and this shouldn't idiomatically come up in any guest language, so this should not be a practically breaking change.

Comment thread crates/runtime/src/component/resources.rs Outdated
Comment thread crates/runtime/src/component/resources.rs Outdated
@github-actions github-actions Bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Dec 8, 2023
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 8, 2023

Subscribe to Label Action

cc @peterhuene

Details This issue or pull request has been labeled: "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

This commit updates the allocation scheme for resources in the component
model to start at 1 instead of 0 when communicating with components.
This is an implementation of WebAssembly/component-model#284.

While this broke a number of tests we have this shouldn't actually break
any components in practice. The broken tests were all overly-precise in
their assertions and error messages and this shouldn't idiomatically
come up in any guest language, so this should not be a practically
breaking change.

This change additionally places an upper limit on the maximum
allocatable index at `1 << 30` which is also specified in the above PR.
@alexcrichton
Copy link
Copy Markdown
Member Author

Oops it appears that I forgot about this, so I've now rebased this and this should be ready again after addressing @rylev's comments.

Copy link
Copy Markdown
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I also forgot all about this

@alexcrichton alexcrichton added this pull request to the merge queue Feb 21, 2024
Merged via the queue into bytecodealliance:main with commit 93f17e3 Feb 21, 2024
@alexcrichton alexcrichton deleted the reserve-index-zero branch February 21, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants