Reduce size of ArgumentOutOfRangeException throw helpers when not inlined#88508
Merged
stephentoub merged 1 commit intodotnet:mainfrom Jul 7, 2023
Merged
Reduce size of ArgumentOutOfRangeException throw helpers when not inlined#88508stephentoub merged 1 commit intodotnet:mainfrom
stephentoub merged 1 commit intodotnet:mainfrom
Conversation
Keeping the arguments of the delegated throw method the same order as the callee avoids unnecessary spilling.
|
Tagging subscribers to this area: @dotnet/area-system-runtime Issue DetailsKeeping the arguments of the delegated throw method the same order as the callee avoids unnecessary spilling. Per #79157 (comment). e.g. L0000: sub rsp, 0x28
L0004: cmp ecx, edx
L0006: jl short L0014
L0008: mov [rsp+0x30], ecx
L000c: mov [rsp+0x38], edx
L0010: cmp ecx, edx
L0012: jg short L0019
L0014: add rsp, 0x28
L0018: ret
L0019: mov rcx, r8
L001c: mov edx, [rsp+0x30]
L0020: mov r8d, [rsp+0x38]
L0025: call 0x00007ffdfec90108
L002a: int3and after: L0000: sub rsp, 0x28
L0004: cmp ecx, edx
L0006: jl short L000c
L0008: cmp ecx, edx
L000a: jg short L0011
L000c: add rsp, 0x28
L0010: ret
L0011: call 0x00007ffdfec90150
L0016: int3cc: @AndyAyersMS
|
danmoseley
approved these changes
Jul 7, 2023
Member
|
Thanks... I have local changes to fix this "redundant" compare but they are a bit complex and fire so infrequently that I am wavering on whether or not to add this. L0000: sub rsp, 0x28
L0004: cmp ecx, edx
L0006: jl short L000c
L0008: cmp ecx, edx
L000a: jg short L0011
L000c: add rsp, 0x28
L0010: ret
L0011: call 0x00007ffdfec90150
L0016: int3
could be
L0000: sub rsp, 0x28
L0004: cmp ecx, edx
L0006: jg short Lxxxx
add rsp, 0x28
ret
Lxxxx: call 0x00007ffdfec90150
int3
(and if we ever really get clever)
cmp ecx, edx
jg short Lxxxx
ret
Lxxxx: sub rsp, 0x28
call 0x00007ffdfec90150
int3 |
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
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.
Keeping the arguments of the delegated throw method the same order as the callee avoids unnecessary spilling. Per #79157 (comment).
e.g.
ThrowIfGreaterThan<int>before:and after:
cc: @AndyAyersMS