Stream: git-wasmtime

Topic: wasmtime / Issue #1177 Windows (Fastcall) calling convent...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 12 2021 at 01:44):

peterhuene commented on Issue #1177:

I believe this has been resolved since March of 2020, but this probably fell through the cracks during the cranelift repo migration; therefore I'm closing this issue now.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 12 2021 at 01:44):

peterhuene closed Issue #1177:

We're having issues, only on Windows, with floating point variables becoming corrupt across calls into Cranelift from Wasmer.

The following function callee_saved_gprs in the codegen is supposed to return a list of the callee-saved registers:

https://github.com/bytecodealliance/cranelift/blob/23e9bdb2d99fb8f554793cb87f1578cc543c355f/cranelift-codegen/src/isa/x86/abi.rs#L370

However, it, nor its callers, seem to concern themselves with saving the floating point callee-saved registers (with gprs in its name, that kind makes sense). Quoth https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019#callercallee-saved-registers:

The registers RBX, RBP, RDI, RSI, RSP, R12, R13, R14, R15, and XMM6-15 are considered nonvolatile and must be saved and restored by a function that uses them.

callee_saved_gprs only lists RBX, RBP, RDI, RSI, RSP, R12, R13, R14, R15, ignoring XMM6-15.

I believe this may be the cause of our troubles, it definitely looks wrong. What do you think?

(If the reserved stack spaced for this would be prohibitive and code is generated assuming no callee saved registers, things could still work internally as they do now, but you'd still need to save XMM6-15 on entering Cranelift and restore them when exiting Cranelift).

view this post on Zulip Wasmtime GitHub notifications bot (Mar 12 2021 at 01:45):

peterhuene edited a comment on Issue #1177:

I believe this has been resolved since April of 2020 (Wasmtime 0.16.0), but this probably fell through the cracks during the cranelift repo migration; therefore I'm closing this issue now.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 12 2021 at 01:47):

peterhuene edited a comment on Issue #1177:

I believe this has been resolved since April of 2020 (Wasmtime 0.16.0; Cranelift 0.69.0), but this probably fell through the cracks during the cranelift repo migration; therefore I'm closing this issue now.


Last updated: Nov 22 2024 at 16:03 UTC