Skip to content

Commit 98bb641

Browse files
authored
Teach x86 unwinder about POP ECX being optional optimization (#115660)
* Teach x86 unwinder about POP ECX being optional optimization * s/epilogBase[0]/epilogBase[offset]/
1 parent 8a071a2 commit 98bb641

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/coreclr/vm/gc_unwind_x86.inl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,7 +2443,7 @@ void UnwindEspFrameEpilog(
24432443

24442444
// We have already popped off the frame (excluding the callee-saved registers)
24452445

2446-
if (epilogBase[0] == X86_INSTR_POP_ECX)
2446+
if (epilogBase[offset] == X86_INSTR_POP_ECX)
24472447
{
24482448
// We may use "POP ecx" for doing "ADD ESP, 4",
24492449
// or we may not (in the case of JMP epilogs)
@@ -2560,8 +2560,11 @@ void UnwindEbpDoubleAlignFrameEpilog(
25602560
{
25612561
// do nothing before popping the callee-saved registers
25622562
}
2563-
else if (info->rawStkSize == sizeof(void*))
2563+
else if (info->rawStkSize == sizeof(void*) && epilogBase[offset] == X86_INSTR_POP_ECX)
25642564
{
2565+
// We may use "POP ecx" for doing "ADD ESP, 4",
2566+
// or we may not (in the case of JMP epilogs)
2567+
25652568
// "pop ecx" will make ESP point to the callee-saved registers
25662569
if (!InstructionAlreadyExecuted(offset, info->epilogOffs))
25672570
ESP += sizeof(void*);

0 commit comments

Comments
 (0)