Fix AMD64 epilog ABI (#54357)
authorBruce Forstall <brucefo@microsoft.com>
Fri, 18 Jun 2021 23:51:50 +0000 (16:51 -0700)
committerGitHub <noreply@github.com>
Fri, 18 Jun 2021 23:51:50 +0000 (16:51 -0700)
commitf5da499194580958cbaca9abdaf209572ec3b748
tree45e88eaec87b2b9546f058d60899c75b94893b46
parent27fece253494ac80f9f13843cbaa0e99a5d502ae
Fix AMD64 epilog ABI (#54357)

* Fix AMD64 epilog ABI

The Windows AMD64 epilog ABI states that an `lea rsp,[rbp+constant]` instruction
may only be used if a frame pointer has been reported to the OS in the prolog
unwind info, otherwise an `add rsp, constant` instruction must be used.
There were a number of cases where the JIT used the `lea` form simply because
a frame pointer had been established and was available, even though it had not
been reported to the OS (and, thus, the frame was effectively an `rsp` frame).

Fix this by using the same condition in the epilog for determining which form
to use, `lea` or `add`, that was used in the prolog to determine whether or not
to report the frame pointer in the unwind info.

Fixes #54320

* Formatting

* Fix OSR
src/coreclr/jit/codegencommon.cpp