alexcrichton opened PR #15247 from alexcrichton:fix-pulley-stack to bytecodealliance:main:
In addition to detecting
PushFrameandPushFrameSave, theStackAlloc32instruction can be used to allocate frames in Pulley in some situations related to the tail call ABI. Detect that here to properly handle the backtrace in these situations in the same manner as before for other functions.<!--
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
-->
alexcrichton removed the review request for wasmtime-core-reviewers from PR #15247.
alexcrichton requested dicej for a review on PR #15247.
alexcrichton requested wasmtime-core-reviewers for a review on PR #15247.
github-actions[bot] added the label wasmtime:api on PR #15247.
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Incomplete sentence or missing word? "that grow the An overflow"
:speech_balloon: cfallin created PR review comment:
This feels pretty brittle to me: usually a good rule of thumb is not to try to interpret or match on shapes in the compiler's output, because it goes beyond the guarantee that the compiler usually makes (only that it will generate some code that has equivalent semantics to the input).
I wonder, could we either split the opcode into two for the two cases, or add some metadata somewhere (morally some kind of "unwind info") to help decode the state of the stack frames relative to the machine state?
alexcrichton requested cfallin for a review on PR #15247.
alexcrichton removed the review request for wasmtime-compiler-reviewers from PR #15247.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #15247.
alexcrichton removed the review request for wasmtime-default-reviewers from PR #15247.
alexcrichton updated PR #15247.
alexcrichton requested fitzgen for a review on PR #15247.
alexcrichton requested wasmtime-default-reviewers for a review on PR #15247.
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
I've adjusted to have a new opcode instead which creates an invariant that the first stack-allocating-opcode either fails or succeeds and pushes fp/lr, and that way the previous check of 2 opcodes is now a check for 3 possible opcodes. In some sense that doesn't really satisfy the property you're describing, we're still pattern-matching on the output of Cranelift. At the same time though this is such a niche case (accuracy of a stack overflow backtrace on Pulley) that I don't think this is worth all the rigamarole of side tables and things like that. I've tried to document the invariant in
abi.rsfor the Cranelift backend, does that seem reasonable?
:thumbs_up: cfallin submitted PR review:
Thanks! This seems fine for now. I guess in essence we can think of the constrained first-instruction choice as a new ISA requirement (any function that runs on the Pulley interpreter must start with ...) and since our ABI impl for the backend always emits a prologue that satisfies this, we can rely on it. Definitely feels better than prior (which, I guess technically, could also have been reified as an ISA requirement but was much more subtle).
cfallin added PR #15247 Fix another Pulley prologue detection case to the merge queue.
:check: cfallin merged PR #15247.
cfallin removed PR #15247 Fix another Pulley prologue detection case from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC