alexcrichton opened PR #10934 from alexcrichton:upstream-index-changes to bytecodealliance:main:
Work recently in the wasip3-prototyping repository has focused on reducing the amount of
unsafecode and improving internal abstractions to facilitate this. One major thrust that's manifested in is the removal of the usage of*mut ComponentInstancewhere possible and instead using an index to safely borrow from the store to get the entire instance. This commit does not fully realize this vision just yet but lays some groundwork leading up to this.This commit specifically removes the
*mut ComponentInstancepointers in lift/lower contexts in favor of directly storing awasmtime::component::Instance. When the rawComponentInstanceis needed it's acquired from theStoreOpaquein a safe fashion that borrows the entire store for the duration of the returned borrow. This in turn required pushing instances into the store earlier during instantiation because during instantiation an instance could call out to host APIs which do lifts/lowers.There's still more work to be done to plumb this fully into libcalls and host function invocations but I wanted to upstream the wasip3 work piecemeal a chunk at a time.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested fitzgen for a review on PR #10934.
alexcrichton requested wasmtime-core-reviewers for a review on PR #10934.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
I'll note that this comment is still equally applicable today, but I don't think it's worth it trying to keep this distinction. It's just too damn useful to be able to get a safe
&mut ComponentInstanceand too subtle to avoid trying to do so. I opened https://github.com/bytecodealliance/wasmtime/issues/10933 to track a better solution here.
fitzgen submitted PR review:
Nice
fitzgen merged PR #10934.
Last updated: Dec 06 2025 at 06:05 UTC