[x86/Linux] Correctly adjust stack for double aligned frames (dotnet/coreclr#9998)
authorJonghyun Park <parjong@gmail.com>
Thu, 9 Mar 2017 01:27:51 +0000 (10:27 +0900)
committerBruce Forstall <brucefo@microsoft.com>
Thu, 9 Mar 2017 01:27:51 +0000 (17:27 -0800)
[x86/Linux] Correct stack align for double aligned frames

Commit migrated from https://github.com/dotnet/coreclr/commit/4e9f01623721f8da6b79793812ecb5b85509092d

src/coreclr/src/jit/lclvars.cpp

index 3a5cfdf..e0d7d51 100644 (file)
@@ -5965,10 +5965,14 @@ void Compiler::lvaAlignFrame()
         }
 
         // Align the stack with STACK_ALIGN value.
-        int adjustFrameSize = compLclFrameSize;
+        int  adjustFrameSize = compLclFrameSize;
 #if defined(UNIX_X86_ABI)
+        bool isEbpPushed     = codeGen->isFramePointerUsed();
+#if DOUBLE_ALIGN
+        isEbpPushed |= genDoubleAlign();
+#endif
         // we need to consider spilled register(s) plus return address and/or EBP
-        int adjustCount = compCalleeRegsPushed + 1 + (codeGen->isFramePointerUsed() ? 1 : 0);
+        int adjustCount = compCalleeRegsPushed + 1 + (isEbpPushed ? 1 : 0);
         adjustFrameSize += (adjustCount * REGSIZE_BYTES) % STACK_ALIGN;
 #endif
         if ((adjustFrameSize % STACK_ALIGN) != 0)