<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/rss.xsl.xml"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Changes in stack-args-exceptions.wast</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>fa1d6867 - Wasmtime/Cranelift: carry &quot;FP to SP offset&quot; in exception data, and use it in stackwalk. (#11500)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/tests/misc_testsuite/stack-args-exceptions.wast#fa1d6867</link>
        <description>Wasmtime/Cranelift: carry &quot;FP to SP offset&quot; in exception data, and use it in stackwalk. (#11500)* Wasmtime/Cranelift: carry &quot;FP to SP offset&quot; in exception data, and use it in stackwalk.Currently Wasmtime unwinds stack frames to look for exception handlersby walking frames one-by-one, following the FP chain as usual, andassuming that *these frames are contiguous*: that is, that the SP inany given frame (bottom of that frame) is immediately above the FP ofthe next lower frame, plus the FP/return address pair (e.g. 16 bytes).This allows us to get the SP for any given frame in addition to FP. Weneed SP for two reasons:- To look up dynamic context, to match Wasm tag instances for handlers  against the thrown tag;- To actually set SP when we resume, if we do resume to a handler in  this frame.This logic *almost but not quite* worked: I had forgotten that in ourtail-call ABI, we need to clean up incoming stack args in thecallee (because only the final callee in a parade of tail-callingfunctions that reuse the same stack frame location knows how many argsit has, not the original caller). This implies that there is an&quot;incoming args area&quot; *above* the FP/return address pair. Thus, framesare not necessarily contiguous by the above definition.In #11489 we see a case where a function of signature `(func)`tail-calls one of `(func (param i32 i32 i32 i32 i32))`, which onx86-64 (with four arg registers left for Wasm) is sufficient to createincoming stack args, which then trips up the unwinder, reading a bogusvmctx and segfaulting.The most reasonable solution seems to be to embed the SP-to-FP offsetin the exception metadata itself, so from only the FP (which istotally robust -- we rely on the FP chain for multiple kinds ofstack-walking) we can get the SP, allowing us to read dynamic contextand to reset SP during resume.This PR does just that. Technically, in our ABI, the SP-to-FP offsetis constant for an entire function, but it was simpler in theexception metadata to encode this per callsite instead (there is noother notion of &quot;per-function&quot; data, only &quot;per-callsite&quot;, so it wouldbe a separate binary search).Fixes #11489.prtest:full* Review feedback.

            List of files:
            /wasmtime-44.0.1/tests/misc_testsuite/stack-args-exceptions.wast</description>
        <pubDate>Thu, 21 Aug 2025 22:40:47 +0000</pubDate>
        <dc:creator>Chris Fallin &lt;chris@cfallin.org&gt;</dc:creator>
    </item>
</channel>
</rss>
