diff options
Diffstat (limited to 'packaging/0009-x86-Linux-Adjust-SP-in-throwing-helper-block-12504-1.patch')
-rw-r--r-- | packaging/0009-x86-Linux-Adjust-SP-in-throwing-helper-block-12504-1.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/packaging/0009-x86-Linux-Adjust-SP-in-throwing-helper-block-12504-1.patch b/packaging/0009-x86-Linux-Adjust-SP-in-throwing-helper-block-12504-1.patch new file mode 100644 index 0000000000..fef96c9ceb --- /dev/null +++ b/packaging/0009-x86-Linux-Adjust-SP-in-throwing-helper-block-12504-1.patch @@ -0,0 +1,65 @@ +From dbfd81c905d8f97aee7b6e595df02d49f98f3f70 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=EB=B0=95=EC=A2=85=ED=98=84/Developer=20Experience=20Lab?= + =?UTF-8?q?=28S/W=EC=84=BC=ED=84=B0=29/Senior=20Engineer/=EC=82=BC?= + =?UTF-8?q?=EC=84=B1=EC=A0=84=EC=9E=90?= <jh1302.park@samsung.com> +Date: Thu, 10 Aug 2017 17:25:46 +0900 +Subject: [PATCH 09/23] [x86/Linux] Adjust SP in throwing helper block (#12504) + (#12) + +* [x86/Linux] Adjust SP in throwing helper block + +* Fix format error + +* Use funKind intead of siInFuncletRegion + +* Use genSPtoFPdelta (and add some comments) + +* Fix a typo + +* Revert irrelevant changes +--- + src/jit/codegencommon.cpp | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp +index 94cc9b9..719299e 100644 +--- a/src/jit/codegencommon.cpp ++++ b/src/jit/codegencommon.cpp +@@ -1642,6 +1642,18 @@ void CodeGen::genAdjustStackLevel(BasicBlock* block) + { + #if !FEATURE_FIXED_OUT_ARGS + // Check for inserted throw blocks and adjust genStackLevel. ++ CLANG_FORMAT_COMMENT_ANCHOR; ++ ++#if defined(UNIX_X86_ABI) ++ if (isFramePointerUsed() && compiler->fgIsThrowHlpBlk(block)) ++ { ++ // x86/Linux requires stack frames to be 16-byte aligned, but SP may be unaligned ++ // at this point if a jump to this block is made in the middle of pushing arugments. ++ // ++ // Here we restore SP to prevent potential stack alignment issues. ++ getEmitter()->emitIns_R_AR(INS_lea, EA_PTRSIZE, REG_SPBASE, REG_FPBASE, -genSPtoFPdelta()); ++ } ++#endif + + if (!isFramePointerUsed() && compiler->fgIsThrowHlpBlk(block)) + { +@@ -2694,7 +2706,14 @@ void CodeGen::genExitCode(BasicBlock* block) + + void CodeGen::genJumpToThrowHlpBlk(emitJumpKind jumpKind, SpecialCodeKind codeKind, GenTreePtr failBlk) + { +- if (!compiler->opts.compDbgCode) ++ bool useThrowHlpBlk = !compiler->opts.compDbgCode; ++ ++#if defined(UNIX_X86_ABI) && FEATURE_EH_FUNCLETS ++ // Inline exception-throwing code in funclet to make it possible to unwind funclet frames. ++ useThrowHlpBlk = useThrowHlpBlk && (compiler->funCurrentFunc()->funKind == FUNC_ROOT); ++#endif // UNIX_X86_ABI && FEATURE_EH_FUNCLETS ++ ++ if (useThrowHlpBlk) + { + /* For non-debuggable code, find and use the helper block for + raising the exception. The block may be shared by other trees too. */ +-- +1.9.1 + |