Skip to content

Conversation

@filipnavara
Copy link
Member

Fixes #115120

The same pattern already exists in the unwinder elsewhere:

if (epilogBase[0] == X86_INSTR_POP_ECX)
{
// We may use "POP ecx" for doing "ADD ESP, 4",
// or we may not (in the case of JMP epilogs)

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label May 16, 2025
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 16, 2025
// do nothing before popping the callee-saved registers
}
else if (info->rawStkSize == sizeof(void*))
else if (info->rawStkSize == sizeof(void*) && epilogBase[0] == X86_INSTR_POP_ECX)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offset is always 0 at this point, so epilogBase[0] and epilogBase[offset] is the same thing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to use the offset even though it is zero. All the remaining code uses offset, even in the code inside of this if, so using 0 here might be confusing for the reader.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed both of the places with the pattern. Optimizing compiler should propagate the constant anyway.

@filipnavara filipnavara requested a review from janvorli May 16, 2025 16:48
@filipnavara filipnavara added arch-x86 area-VM-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 16, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good modulo the comment.

// do nothing before popping the callee-saved registers
}
else if (info->rawStkSize == sizeof(void*))
else if (info->rawStkSize == sizeof(void*) && epilogBase[0] == X86_INSTR_POP_ECX)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to use the offset even though it is zero. All the remaining code uses offset, even in the code inside of this if, so using 0 here might be confusing for the reader.

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@janvorli janvorli merged commit 98bb641 into dotnet:main May 16, 2025
93 of 95 checks passed
@filipnavara filipnavara deleted the unwind-lea branch June 5, 2025 06:44
@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-x86 area-VM-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assert failure: CheckInstrBytePattern(base[offset] & 0xF8, 0x58, base[offset])

2 participants