From: sergey ignatov Date: Fri, 19 Jan 2018 14:28:38 +0000 (+0300) Subject: [armel tizen] Fixed CoreRT issue #4626 unwinding support (#15913) X-Git-Tag: accepted/tizen/base/20180629.140029~108 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1c732878777092468ef8da8cd61aa8ec0922948;p=platform%2Fupstream%2Fcoreclr.git [armel tizen] Fixed CoreRT issue #4626 unwinding support (#15913) --- diff --git a/src/jit/compiler.h b/src/jit/compiler.h index 7f2f3b8..bc039df 100644 --- a/src/jit/compiler.h +++ b/src/jit/compiler.h @@ -7377,9 +7377,9 @@ private: #if defined(_TARGET_UNIX_) int mapRegNumToDwarfReg(regNumber reg); void createCfiCode(FuncInfoDsc* func, UCHAR codeOffset, UCHAR opcode, USHORT dwarfReg, INT offset = 0); - void unwindPushCFI(regNumber reg); + void unwindPushPopCFI(regNumber reg); void unwindBegPrologCFI(); - void unwindPushMaskCFI(regMaskTP regMask, bool isFloat); + void unwindPushPopMaskCFI(regMaskTP regMask, bool isFloat); void unwindAllocStackCFI(unsigned size); void unwindSetFrameRegCFI(regNumber reg, unsigned offset); void unwindEmitFuncCFI(FuncInfoDsc* func, void* pHotCode, void* pColdCode); diff --git a/src/jit/unwind.cpp b/src/jit/unwind.cpp index 643f15a..773339d 100644 --- a/src/jit/unwind.cpp +++ b/src/jit/unwind.cpp @@ -126,16 +126,25 @@ void Compiler::createCfiCode(FuncInfoDsc* func, UCHAR codeOffset, UCHAR cfiOpcod func->cfiCodes->push_back(cfiEntry); } -void Compiler::unwindPushCFI(regNumber reg) +void Compiler::unwindPushPopCFI(regNumber reg) { +#if defined(_TARGET_ARM_) + assert(compGeneratingEpilog); +#else assert(compGeneratingProlog); +#endif FuncInfoDsc* func = funCurrentFunc(); - unsigned int cbProlog = unwindGetCurrentOffset(func); - noway_assert((BYTE)cbProlog == cbProlog); + unsigned int cbProlog = 0; + if (compGeneratingProlog) + { + cbProlog = unwindGetCurrentOffset(func); + noway_assert((BYTE)cbProlog == cbProlog); + + createCfiCode(func, cbProlog, CFI_ADJUST_CFA_OFFSET, DWARF_REG_ILLEGAL, REGSIZE_BYTES == 8 ? 8 : 4); + } - createCfiCode(func, cbProlog, CFI_ADJUST_CFA_OFFSET, DWARF_REG_ILLEGAL, REGSIZE_BYTES == 8 ? 8 : 4); if ((RBM_CALLEE_SAVED & genRegMask(reg)) #if defined(UNIX_AMD64_ABI) #if ETW_EBP_FRAMED @@ -183,7 +192,7 @@ void Compiler::unwindBegPrologCFI() #endif // FEATURE_EH_FUNCLETS } -void Compiler::unwindPushMaskCFI(regMaskTP regMask, bool isFloat) +void Compiler::unwindPushPopMaskCFI(regMaskTP regMask, bool isFloat) { regMaskTP regBit = isFloat ? genRegMask(REG_FP_FIRST) : 1; @@ -197,7 +206,7 @@ void Compiler::unwindPushMaskCFI(regMaskTP regMask, bool isFloat) if (regBit & regMask) { - unwindPushCFI(regNum); + unwindPushPopCFI(regNum); } } } diff --git a/src/jit/unwindamd64.cpp b/src/jit/unwindamd64.cpp index d4c077e..a0cbfb1 100644 --- a/src/jit/unwindamd64.cpp +++ b/src/jit/unwindamd64.cpp @@ -209,7 +209,7 @@ void Compiler::unwindPush(regNumber reg) #ifdef UNIX_AMD64_ABI if (generateCFIUnwindCodes()) { - unwindPushCFI(reg); + unwindPushPopCFI(reg); } else #endif // UNIX_AMD64_ABI diff --git a/src/jit/unwindarm.cpp b/src/jit/unwindarm.cpp index 8c01648..9bb07ec 100644 --- a/src/jit/unwindarm.cpp +++ b/src/jit/unwindarm.cpp @@ -371,7 +371,6 @@ void Compiler::unwindPushMaskInt(regMaskTP maskInt) #if defined(_TARGET_UNIX_) if (generateCFIUnwindCodes()) { - unwindPushMaskCFI(maskInt, false); return; } #endif // _TARGET_UNIX_ @@ -388,7 +387,6 @@ void Compiler::unwindPushMaskFloat(regMaskTP maskFloat) #if defined(_TARGET_UNIX_) if (generateCFIUnwindCodes()) { - unwindPushMaskCFI(maskFloat, true); return; } #endif // _TARGET_UNIX_ @@ -401,6 +399,7 @@ void Compiler::unwindPopMaskInt(regMaskTP maskInt) #if defined(_TARGET_UNIX_) if (generateCFIUnwindCodes()) { + unwindPushPopMaskCFI(maskInt, false); return; } #endif // _TARGET_UNIX_ @@ -429,6 +428,7 @@ void Compiler::unwindPopMaskFloat(regMaskTP maskFloat) #if defined(_TARGET_UNIX_) if (generateCFIUnwindCodes()) { + unwindPushPopMaskCFI(maskFloat, true); return; } #endif // _TARGET_UNIX_ @@ -443,7 +443,7 @@ void Compiler::unwindAllocStack(unsigned size) #if defined(_TARGET_UNIX_) if (generateCFIUnwindCodes()) { - if (compGeneratingProlog) + if (compGeneratingEpilog) { unwindAllocStackCFI(size); } @@ -497,7 +497,7 @@ void Compiler::unwindSetFrameReg(regNumber reg, unsigned offset) #if defined(_TARGET_UNIX_) if (generateCFIUnwindCodes()) { - if (compGeneratingProlog) + if (compGeneratingEpilog) { unwindSetFrameRegCFI(reg, offset); }