Skip to content

Use Pin<&mut ComponentInstance> #11042

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

Merged
merged 1 commit into from
Jun 14, 2025

Conversation

alexcrichton
Copy link
Member

This commit is the continuation of #10943 for component instances. The allocation/vmctx infrastructure was additionally refactored to be shared for both core and component instances since they behave the exact same way anyway. This further enables sharing various methods like vmctx_plus_offset which are pretty unsafe internally.

Like #10943 this necessitated removal of Index implementations because IndexMut is not compatible with the returned type being Pin<&mut T> so they were replaced by inherent get and get_mut methods on the component instance id type.

Closes #10933

This commit is the continuation of bytecodealliance#10943 for component instances. The
allocation/vmctx infrastructure was additionally refactored to be shared for
both core and component instances since they behave the exact same way anyway.
This further enables sharing various methods like `vmctx_plus_offset` which are
pretty unsafe internally.

Like bytecodealliance#10943 this necessitated removal of `Index` implementations because
`IndexMut` is not compatible with the returned type being `Pin<&mut T>`
so they were replaced by inherent `get` and `get_mut` methods on the
component instance id type.

Closes bytecodealliance#10933
@alexcrichton alexcrichton requested a review from a team as a code owner June 13, 2025 22:02
@alexcrichton alexcrichton requested review from dicej and removed request for a team June 13, 2025 22:02
@alexcrichton
Copy link
Member Author

cc @fitzgen you're probably also interested in these refactorings.

@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Jun 14, 2025
Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Nice!

@fitzgen fitzgen added this pull request to the merge queue Jun 14, 2025
Merged via the queue into bytecodealliance:main with commit 7e28c25 Jun 14, 2025
41 checks passed
@alexcrichton alexcrichton deleted the component-instance-pin branch June 14, 2025 02:33
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.

Technically &mut Instance is not safe
2 participants