From c22d94f239f355dade0a71fc9a6e019e037d6747 Mon Sep 17 00:00:00 2001 From: Eugene Rozenfeld Date: Sat, 30 May 2020 16:34:19 -0700 Subject: [PATCH] Fix fast tail calls on Windows ARM64. (#37192) 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. --- src/coreclr/src/jit/lower.cpp | 6 +++--- src/coreclr/tests/issues.targets | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/coreclr/src/jit/lower.cpp b/src/coreclr/src/jit/lower.cpp index 75d63a18661f7..07d15696de9b1 100644 --- a/src/coreclr/src/jit/lower.cpp +++ b/src/coreclr/src/jit/lower.cpp @@ -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 @@ -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(callerArgDsc->lvArgStackSize()); diff --git a/src/coreclr/tests/issues.targets b/src/coreclr/tests/issues.targets index da519144b070e..ed9731338b968 100644 --- a/src/coreclr/tests/issues.targets +++ b/src/coreclr/tests/issues.targets @@ -597,12 +597,6 @@ Condition17::Test1 checks that we tail call via helper when security cookie is needed; on arm64 we fast tail call in this case. - - https://github.com/dotnet/runtime/issues/31729 - - - https://github.com/dotnet/runtime/issues/31729 - extremely memory/time intensive test