fitzgen opened PR #14962 from fitzgen:transfer-borrow-to-owner to bytecodealliance:main:
When passing a resource borrow to the instance that defined the resource type, we do not put the borrow into the instance's table, but instead return the resource's rep directly. We actually statically know whether we are in this case or not, so this commit makes us emit a separate libcall that skips the dynamic check of whether we can save work or not and just does the right thing automatically.
This is not really a win by itself in practice, but is meant instead to start paving the way for an eventual inline fast path for this scenario.
<!--
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 review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen requested wasmtime-compiler-reviewers for a review on PR #14962.
fitzgen requested cfallin for a review on PR #14962.
fitzgen removed the review request for wasmtime-compiler-reviewers from PR #14962.
fitzgen requested wasmtime-core-reviewers for a review on PR #14962.
:thumbs_up: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
This looks like it's not actually running anything, is that intentional?
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Yeah, it exists to just make sure that we also compile the non-owner code path, but we can't really actually run it in the wast tests without host cooperation. Maybe it makes more sense as a disas test? Or do you think it is worth promoting to a
#[test]and actually running the code?
github-actions[bot] added the label wasmtime:api on PR #14962.
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Ah ok, not worth a
#[test]IMO, but this might be runnable by having another component which calls this component with a borrow perhaps? I think thehostinterface has some sort of resource-creation functionality.
fitzgen updated PR #14962.
fitzgen has enabled auto merge for PR #14962.
fitzgen added PR #14962 Add a dedicated libcall for passing resource borrows to their owners to the merge queue.
:check: fitzgen merged PR #14962.
fitzgen removed PR #14962 Add a dedicated libcall for passing resource borrows to their owners from the merge queue.
Last updated: Oct 31 2026 at 23:03 UTC