alexcrichton opened PR #11324 from alexcrichton:intern-options to bytecodealliance:main:
This commit is a refactoring of how canonical ABI options are handled during compilation and runtime. Previously options were "exploded" meaning that options were all passed around as parameters but this was a bummer for a few reasons:
This is
unsafe-prone as options have raw pointers such as memory and functions. This meant that all functions/operations working with options were fundamentallyunsafe.This was unwieldy as the set of options continues to grow larger over time. The
VMLoweringCalleefunction previously had 10+ parameters, most of which were canonical ABI options.To solve these two problems options are now intern'd at compile time to an
OptionsIndex, a 32-bit value. This is stored as a new table in component metadata and consulted at runtime. This means thatOptionsIndexcan be passed around with an instance for a much safer means of threading options around. Additionally there's no need to pass around all parameters individually and instead just one parameter,OptionsIndex, need be threaded through.This commit additionally overhauls trampoline generation for the component compiler to avoid a function-per-intrinsic and instead have a single function that all intrinsics use. I found this easier to understand and helps codify that all intrinsics are basically the same with some minor details differing between them.
The end result of this is (hopefully) a net simplification of the component compiler in addition to a large amount of removal of
unsafecode in the async implementation as only safe types are passed around now instead of raw pointers.Closes #10143
Closes #11188<!--
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 abrown for a review on PR #11324.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #11324.
alexcrichton requested fitzgen for a review on PR #11324.
alexcrichton requested wasmtime-core-reviewers for a review on PR #11324.
alexcrichton updated PR #11324.
alexcrichton updated PR #11324.
fitzgen submitted PR review:
LGTM!
fitzgen has enabled auto merge for PR #11324.
fitzgen merged PR #11324.
Last updated: Dec 06 2025 at 06:05 UTC