This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
JIT: update epilog exit size assert for x86 #25302
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
With the advent of dotnet#25251 we can now see the epilog exit sequence on x86 vary by as much as 6 bytes. Update the assert accordingly.
Member
Author
|
cc @dotnet/jit-contrib Example from bug is: ; Assembly listing for method TestCase.Test:Fact1(byref,byref):int
;; 7 byte mov + jmp
B80C639907 mov eax, 0x799630C
FF20 jmp dword ptr [eax]TestCase.Test:Fact1(byref,byref):int
;; 1 byte ret
C3 ret |
BruceForstall
approved these changes
Jun 21, 2019
BruceForstall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems weird we generate a 'ret' there instead of an 'int 3'
Member
Author
|
It is a different epilog -- I just edited out the rest of the code. Here's the full disassembly: G_M33028_IG01:
55 push ebp
8BEC mov ebp, esp
83EC0C sub esp, 12
33C0 xor eax, eax
8945F4 mov dword ptr [ebp-0CH], eax
894DFC mov bword ptr [ebp-04H], ecx
8955F8 mov bword ptr [ebp-08H], edx
G_M33028_IG02:
833D6C52990700 cmp dword ptr [0799526CH], 0
7405 je SHORT G_M33028_IG03
E8C99F7F4E call CORINFO_HELP_DBG_IS_JUST_MY_CODE
G_M33028_IG03:
8B45FC mov eax, bword ptr [ebp-04H]
833801 cmp dword ptr [eax], 1
7F09 jg SHORT G_M33028_IG04
C745F445230100 mov dword ptr [ebp-0CH], 0x12345
EB25 jmp SHORT G_M33028_IG06
G_M33028_IG04:
8B45F8 mov eax, bword ptr [ebp-08H]
8B00 mov eax, dword ptr [eax]
8B55FC mov edx, bword ptr [ebp-04H]
0FAF02 imul eax, dword ptr [edx]
8B55F8 mov edx, bword ptr [ebp-08H]
8902 mov dword ptr [edx], eax
8B45FC mov eax, bword ptr [ebp-04H]
FF08 dec dword ptr [eax]
8B4DFC mov ecx, bword ptr [ebp-04H]
8B55F8 mov edx, bword ptr [ebp-08H]
G_M33028_IG05:
8BE5 mov esp, ebp
5D pop ebp
B80C639907 mov eax, 0x799630C
FF20 jmp dword ptr [eax]TestCase.Test:Fact1(byref,byref):int
G_M33028_IG06:
8B45F4 mov eax, dword ptr [ebp-0CH]
G_M33028_IG07:
8BE5 mov esp, ebp
5D pop ebp
C3 ret
; Total bytes of code 92, prolog size 17 for method TestCase.Test:Fact1(byref,byref):intNote on x86 we always can fit the indir cell address into a 32 bit displacement, so following up on #25286 would compact this back down. |
AndyAyersMS
added a commit
to AndyAyersMS/coreclr
that referenced
this pull request
Jun 24, 2019
On x86 we can always reach any IAT_PVALUE entry via a 32 bit indirect jump, and proper handling of jmp epilogs depends on this. So check if the target address is reachable in 32 bits, and if so, use the jmp [addr] form on x86, and the jmp [rip + disp] form for x64. Fixes #25345 Fixes #25346 Undoes the assertion change from dotnet#25302 Fixes #25286
jkotas
pushed a commit
that referenced
this pull request
Jun 24, 2019
On x86 we can always reach any IAT_PVALUE entry via a 32 bit indirect jump, and proper handling of jmp epilogs depends on this. So check if the target address is reachable in 32 bits, and if so, use the jmp [addr] form on x86, and the jmp [rip + disp] form for x64. Fixes #25345 Fixes #25346 Undoes the assertion change from #25302 Fixes #25286
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
With the advent of dotnet/coreclr#25251 we can now see the epilog exit sequence on x86 vary by as much as 6 bytes. Update the assert accordingly. Fixes dotnet/coreclr#25301. Commit migrated from dotnet/coreclr@e31c78b
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
…r#25348) On x86 we can always reach any IAT_PVALUE entry via a 32 bit indirect jump, and proper handling of jmp epilogs depends on this. So check if the target address is reachable in 32 bits, and if so, use the jmp [addr] form on x86, and the jmp [rip + disp] form for x64. Fixes dotnet/coreclr#25345 Fixes dotnet/coreclr#25346 Undoes the assertion change from dotnet/coreclr#25302 Fixes dotnet/coreclr#25286 Commit migrated from dotnet/coreclr@bad8d91
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the advent of #25251 we can now see the epilog exit sequence on x86 vary
by as much as 6 bytes. Update the assert accordingly.