Stream: git-wasmtime

Topic: wasmtime / issue #1149 Improve code generation for Window...


view this post on Zulip Wasmtime GitHub notifications bot (May 04 2022 at 22:19):

cfallin labeled issue #1149:

Improve the code generation for Windows x64 ABI (a.k.a. "fastcall") by omitting frame pointers when possible, using the caller-provided shadow space as spill slots for optimized compilation, and omit prologues/epilogues entirely for true "leaf" functions.

Reduced code generation size and improved performance on optimized compilations when targeting Windows.

Windows x64 ABI has strict requirements for function prologues and epilogues. This enables the OS to consistently walk and unwind the stack during exception handling.

Because of these strict requirements, a frame pointer is rarely needed for the purpose of unwinding and is only required for a frame doing a dynamic allocation (i.e. alloca). However, omitting the frame pointer might actually increase instruction sizes based on the displacement from a frame pointer vs. the current stack pointer. This should be taken into account when deciding if a frame pointer should be omitted.

Additionally, an explicit stack frame is not necessary at all for "leaf" functions. We can omit prologue, epilogue, and unwind information generation entirely for functions that don't:

I therefore propose the following changes:

The result should be smaller function code generation on Windows, especially in the case of leaf functions.

I have not considered alternative implementations.

This issue was motivated by bytecodealliance/wasmtime#1148.


Last updated: Dec 23 2024 at 13:07 UTC