Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit f1c7328

Browse files
sergign60jkotas
authored andcommitted
[armel tizen] Fixed CoreRT issue #4626 unwinding support (#15913)
1 parent 38cf930 commit f1c7328

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

src/jit/compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7377,9 +7377,9 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
73777377
#if defined(_TARGET_UNIX_)
73787378
int mapRegNumToDwarfReg(regNumber reg);
73797379
void createCfiCode(FuncInfoDsc* func, UCHAR codeOffset, UCHAR opcode, USHORT dwarfReg, INT offset = 0);
7380-
void unwindPushCFI(regNumber reg);
7380+
void unwindPushPopCFI(regNumber reg);
73817381
void unwindBegPrologCFI();
7382-
void unwindPushMaskCFI(regMaskTP regMask, bool isFloat);
7382+
void unwindPushPopMaskCFI(regMaskTP regMask, bool isFloat);
73837383
void unwindAllocStackCFI(unsigned size);
73847384
void unwindSetFrameRegCFI(regNumber reg, unsigned offset);
73857385
void unwindEmitFuncCFI(FuncInfoDsc* func, void* pHotCode, void* pColdCode);

src/jit/unwind.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,25 @@ void Compiler::createCfiCode(FuncInfoDsc* func, UCHAR codeOffset, UCHAR cfiOpcod
126126
func->cfiCodes->push_back(cfiEntry);
127127
}
128128

129-
void Compiler::unwindPushCFI(regNumber reg)
129+
void Compiler::unwindPushPopCFI(regNumber reg)
130130
{
131+
#if defined(_TARGET_ARM_)
132+
assert(compGeneratingEpilog);
133+
#else
131134
assert(compGeneratingProlog);
135+
#endif
132136

133137
FuncInfoDsc* func = funCurrentFunc();
134138

135-
unsigned int cbProlog = unwindGetCurrentOffset(func);
136-
noway_assert((BYTE)cbProlog == cbProlog);
139+
unsigned int cbProlog = 0;
140+
if (compGeneratingProlog)
141+
{
142+
cbProlog = unwindGetCurrentOffset(func);
143+
noway_assert((BYTE)cbProlog == cbProlog);
144+
145+
createCfiCode(func, cbProlog, CFI_ADJUST_CFA_OFFSET, DWARF_REG_ILLEGAL, REGSIZE_BYTES == 8 ? 8 : 4);
146+
}
137147

138-
createCfiCode(func, cbProlog, CFI_ADJUST_CFA_OFFSET, DWARF_REG_ILLEGAL, REGSIZE_BYTES == 8 ? 8 : 4);
139148
if ((RBM_CALLEE_SAVED & genRegMask(reg))
140149
#if defined(UNIX_AMD64_ABI)
141150
#if ETW_EBP_FRAMED
@@ -183,7 +192,7 @@ void Compiler::unwindBegPrologCFI()
183192
#endif // FEATURE_EH_FUNCLETS
184193
}
185194

186-
void Compiler::unwindPushMaskCFI(regMaskTP regMask, bool isFloat)
195+
void Compiler::unwindPushPopMaskCFI(regMaskTP regMask, bool isFloat)
187196
{
188197
regMaskTP regBit = isFloat ? genRegMask(REG_FP_FIRST) : 1;
189198

@@ -197,7 +206,7 @@ void Compiler::unwindPushMaskCFI(regMaskTP regMask, bool isFloat)
197206

198207
if (regBit & regMask)
199208
{
200-
unwindPushCFI(regNum);
209+
unwindPushPopCFI(regNum);
201210
}
202211
}
203212
}

src/jit/unwindamd64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void Compiler::unwindPush(regNumber reg)
209209
#ifdef UNIX_AMD64_ABI
210210
if (generateCFIUnwindCodes())
211211
{
212-
unwindPushCFI(reg);
212+
unwindPushPopCFI(reg);
213213
}
214214
else
215215
#endif // UNIX_AMD64_ABI

src/jit/unwindarm.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ void Compiler::unwindPushMaskInt(regMaskTP maskInt)
371371
#if defined(_TARGET_UNIX_)
372372
if (generateCFIUnwindCodes())
373373
{
374-
unwindPushMaskCFI(maskInt, false);
375374
return;
376375
}
377376
#endif // _TARGET_UNIX_
@@ -388,7 +387,6 @@ void Compiler::unwindPushMaskFloat(regMaskTP maskFloat)
388387
#if defined(_TARGET_UNIX_)
389388
if (generateCFIUnwindCodes())
390389
{
391-
unwindPushMaskCFI(maskFloat, true);
392390
return;
393391
}
394392
#endif // _TARGET_UNIX_
@@ -401,6 +399,7 @@ void Compiler::unwindPopMaskInt(regMaskTP maskInt)
401399
#if defined(_TARGET_UNIX_)
402400
if (generateCFIUnwindCodes())
403401
{
402+
unwindPushPopMaskCFI(maskInt, false);
404403
return;
405404
}
406405
#endif // _TARGET_UNIX_
@@ -429,6 +428,7 @@ void Compiler::unwindPopMaskFloat(regMaskTP maskFloat)
429428
#if defined(_TARGET_UNIX_)
430429
if (generateCFIUnwindCodes())
431430
{
431+
unwindPushPopMaskCFI(maskFloat, true);
432432
return;
433433
}
434434
#endif // _TARGET_UNIX_
@@ -443,7 +443,7 @@ void Compiler::unwindAllocStack(unsigned size)
443443
#if defined(_TARGET_UNIX_)
444444
if (generateCFIUnwindCodes())
445445
{
446-
if (compGeneratingProlog)
446+
if (compGeneratingEpilog)
447447
{
448448
unwindAllocStackCFI(size);
449449
}
@@ -497,7 +497,7 @@ void Compiler::unwindSetFrameReg(regNumber reg, unsigned offset)
497497
#if defined(_TARGET_UNIX_)
498498
if (generateCFIUnwindCodes())
499499
{
500-
if (compGeneratingProlog)
500+
if (compGeneratingEpilog)
501501
{
502502
unwindSetFrameRegCFI(reg, offset);
503503
}

0 commit comments

Comments
 (0)