Adjust clr-abi for new arm32 call-finally behavior#95596
Merged
BruceForstall merged 1 commit intodotnet:mainfrom Dec 4, 2023
Merged
Adjust clr-abi for new arm32 call-finally behavior#95596BruceForstall merged 1 commit intodotnet:mainfrom
BruceForstall merged 1 commit intodotnet:mainfrom
Conversation
Due to change in dotnet#95117
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsDue to change in #95117
|
BruceForstall
commented
Dec 4, 2023
|
|
||
| The OS unwinder uses the `RUNTIME_FUNCTION` extents to determine which function or funclet to unwind out of. The net result is that a call (bl opcode) to `IL_Throw` cannot be the last thing. So similar to AMD64 the JIT must inject an opcode (a breakpoint in this case) when the `bl IL_Throw` would otherwise be the last opcode of a function or funclet, the last opcode before the end of the hot section, or (this might be an x86-ism leaking into ARM) the last before a "special throw block". | ||
|
|
||
| The CLR unwinder assumes any non-leaf frame was unwound as a result of a call. This is mostly (always?) true except for non-exceptional finally invocations. For those cases, the JIT must place a 2 byte NOP **before** the address set as the finally return address (in the LR register, before jumping to the finally). I believe this is only needed if the preceding 2 bytes would have otherwise been in a different region (i.e. the end or start of a try body, etc.), but currently the JIT always emits the NOP. This is because the stack walker looks at the return address, subtracts 2, and uses that as the PC for the next step of stack walking. Note that the inserted NOP must have correct GC information. |
Contributor
Author
There was a problem hiding this comment.
The code to insert the NOP was removed; it was only applicable to arm32 (other platforms always did a normal 'call').
jakobbotsch
approved these changes
Dec 4, 2023
Member
jakobbotsch
left a comment
There was a problem hiding this comment.
Thanks! Missed that this was documented here.
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.
Due to change in #95117