Stream: git-wasmtime

Topic: wasmtime / PR #12447 Cranelift: preserve_all: disallow re...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 16:35):

cfallin opened PR #12447 from cfallin:preserve-all-no-returns to bytecodealliance:main:

In #12399 a fuzzbug uncovered an issue whereby a function with preserve_all and with many return values cannot be called, because emit_retval_loads cannot codegen memory-to-memory moves (from on-stack return value slots directly to spillslots) without a temporary/clobberable register, and preserve_all implies no such registers exist.

I thought about trying to support this by shuffling registers -- such a case implies many return values, and at least some of them will be in registers, so we might be able to temporarily spill one of those and use it as a scratch to move other values memory-to-memory. But the complexity doesn't seem worthwhile, and this path is not actually needed at the moment.

Thinking more broadly, anyone using preserve_all for hooks meant to minimally perturb register state will likely not want to use many return values anyway (that defeats the point). We could allow one return value, with the knowledge that this always fits in a register in our existing ABIs, but that also feels somewhat arbitrary, and I could make the argument that "preserve all" should really mean preserve all. Someone wanting to return a value anyway from such a hook could use indirect means (pass in a pointer to a stackslot, for example). I'm happy to tweak this limit if others have more thoughts, however.

Fixes #12399.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 16:35):

cfallin requested wasmtime-compiler-reviewers for a review on PR #12447.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 16:35):

cfallin requested alexcrichton for a review on PR #12447.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 17:50):

github-actions[bot] added the label cranelift on PR #12447.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 17:50):

github-actions[bot] added the label cranelift:area:machinst on PR #12447.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 18:19):

fitzgen submitted PR review:

SGTM!

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 18:19):

fitzgen added PR #12447 Cranelift: preserve_all: disallow return values. to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 18:48):

github-merge-queue[bot] removed PR #12447 Cranelift: preserve_all: disallow return values. from the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 18:50):

cfallin commented on PR #12447:

Spurious CI failure in a MinGW package download; retrying.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 18:50):

cfallin added PR #12447 Cranelift: preserve_all: disallow return values. to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 19:34):

cfallin merged PR #12447.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 19:34):

cfallin removed PR #12447 Cranelift: preserve_all: disallow return values. from the merge queue


Last updated: Jan 29 2026 at 13:25 UTC