-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
The tests are failing on Windows and I looked into the matter. The problem lies in setjmp/longjmp functions which unwind on Windows. I have implemented workaround here #265 (comment).
Goal: compatibility with SEH, so wasm trap can freely unwind through different stack frames: wasm, Rust, C++ and more.
Major work to be done: our compiler, cranelift, should provide us with unwind information
Firefox implementation: doesn't rely on SEH; it manually iterates over wasm frames and performs the clean up, and uses custom thunks to restore stack pointer.
Helpful references:
- unwind procedure and unwind info ABI
- nice example of manual analysis of unwind info generated by C# JIT
- talk about Structured Exception Handling (SEH) - CppCon 2018: James McNellis “Unwinding the Stack: Exploring How C++ Exceptions Work on Windows”, slides here
- patch based on one of my local branches with some scratch code; most interesting are
code_memory.rsandTrampolines.c. The whole thing is not supposed to work, it's just a nice reference for future with already written code. - analogous code in Firefox. My understanding is: this handler shouldn't be called anyway. Vectored Exception Handler handles the exceptions - overwrites the PC in stored context to custom handler and tells OS to continue execution. In wasmtime we currently unwind directly from the Vectored Exception Handler.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels