From: Jonghyun Park Date: Thu, 9 Mar 2017 01:27:51 +0000 (+0900) Subject: [x86/Linux] Correctly adjust stack for double aligned frames (dotnet/coreclr#9998) X-Git-Tag: submit/tizen/20210909.063632~11030^2~7793 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c1a5360fa16aab9f7da82ed4217398acae320c91;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [x86/Linux] Correctly adjust stack for double aligned frames (dotnet/coreclr#9998) [x86/Linux] Correct stack align for double aligned frames Commit migrated from https://github.com/dotnet/coreclr/commit/4e9f01623721f8da6b79793812ecb5b85509092d --- diff --git a/src/coreclr/src/jit/lclvars.cpp b/src/coreclr/src/jit/lclvars.cpp index 3a5cfdf..e0d7d51 100644 --- a/src/coreclr/src/jit/lclvars.cpp +++ b/src/coreclr/src/jit/lclvars.cpp @@ -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)