Skip to content

Commit

Permalink
Fix fast tail calls on Windows ARM64. (#37192)
Browse files Browse the repository at this point in the history
LowerFastTailCall has code that looks for incoming stack arguments
that may be overwritten by outgoing stack arguments and copies
them to a temp. The logic was incorrect for Windows Arm64 because it was
assuming shadow space, which only exists in Windows x64 abi.

Fixes #31729.
Fixes #36911.
  • Loading branch information
erozenfeld authored May 30, 2020
1 parent d96f151 commit c22d94f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/coreclr/src/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,7 @@ void Lowering::LowerFastTailCall(GenTreeCall* call)

unsigned int overwrittenStart = put->getArgOffset();
unsigned int overwrittenEnd = overwrittenStart + put->getArgSize();
#if !(defined(TARGET_WINDOWS) && defined(TARGET_64BIT))
#if !(defined(TARGET_WINDOWS) && defined(TARGET_AMD64))
int baseOff = -1; // Stack offset of first arg on stack
#endif

Expand All @@ -1883,8 +1883,8 @@ void Lowering::LowerFastTailCall(GenTreeCall* call)
continue;
}

#if defined(TARGET_WINDOWS) && defined(TARGET_64BIT)
// On Win64, the argument position determines the stack slot uniquely, and even the
#if defined(TARGET_WINDOWS) && defined(TARGET_AMD64)
// On Windows x64, the argument position determines the stack slot uniquely, and even the
// register args take up space in the stack frame (shadow space).
unsigned int argStart = callerArgLclNum * TARGET_POINTER_SIZE;
unsigned int argEnd = argStart + static_cast<unsigned int>(callerArgDsc->lvArgStackSize());
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,6 @@
<ExcludeList Include="$(XunitTestBinBase)/JIT/opt/Tailcall/TailcallVerifyWithPrefix/*">
<Issue>Condition17::Test1 checks that we tail call via helper when security cookie is needed; on arm64 we fast tail call in this case.</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/JIT/Stress/ABI/tailcalls_d/*">
<Issue>https://github.com/dotnet/runtime/issues/31729</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/JIT/Stress/ABI/tailcalls_do/*">
<Issue>https://github.com/dotnet/runtime/issues/31729</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/GC/Regressions/dev10bugs/536168/536168/*">
<Issue>extremely memory/time intensive test</Issue>
</ExcludeList>
Expand Down

0 comments on commit c22d94f

Please sign in to comment.