Stream: git-wasmtime

Topic: wasmtime / PR #9725 [s390x] Fix SP unwind rule for the ta...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 04 2024 at 01:32):

uweigand requested abrown for a review on PR #9725.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 04 2024 at 01:32):

uweigand requested wasmtime-compiler-reviewers for a review on PR #9725.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 04 2024 at 01:32):

uweigand opened PR #9725 from uweigand:s390x-tailcall-unwindfix to bytecodealliance:main:

On s390x, the unwound SP is always at current CFA - 160. Therefore, the default rule used on most other platforms (which sets the unwound SP to the current CFA) is incorrect, so we need to provide an explicit DWARF CFI rule to unwind SP.

With the platform ABI, the caller's SP is always stored in the register save area like other call-saved GPRs, so we can simply use a normal DW_CFA_offset rule. However, with the new tail-call ABI, the value saved in that slot is incorrect - it is not corrected for the incoming tail-call stack arguments that will have been removed as the tail call returns.

To fix this without introducing unnecessary run-time overhead, we can simply use a DW_CFA_val_offset rule that will set the unwound SP to CFA - 160, which is always correct. However, the current UnwindInst abstraction does not allow any way to generate this DWARF CFI instruction. Therefore, we introduce a new UnwindInst::RegStackOffset rule for this purpose.

Fixes: https://github.com/bytecodealliance/wasmtime/issues/9719

<!--
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 (Dec 04 2024 at 15:30):

alexcrichton submitted PR review:

Thanks for this!

view this post on Zulip Wasmtime GitHub notifications bot (Dec 04 2024 at 15:47):

alexcrichton merged PR #9725.


Last updated: Dec 23 2024 at 12:05 UTC