JIT: Handle x86 gs cookie checks before tailcalls#121169
Merged
jakobbotsch merged 1 commit intodotnet:mainfrom Oct 30, 2025
Merged
JIT: Handle x86 gs cookie checks before tailcalls#121169jakobbotsch merged 1 commit intodotnet:mainfrom
jakobbotsch merged 1 commit intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the x86 GS cookie check logic by adding support for tail calls. Previously, the code asserted that tail calls were not supported on x86, but this was incorrect as explicit tail calls and CEE_JMP instructions can occur on this platform.
Key Changes
- Removed the incorrect
assert(!tailCall)on x86 that prevented tail calls from being handled - Added a tail call path that returns
RBM_ESI(a callee-saved register) to avoid conflicts with argument registers - Updated comment to reflect the handling of both regular calls and tail calls
Member
Author
|
PTAL @dotnet/jit-contrib. More edge cases around register picking for the GS cookie check. This kind of codegen that is not under LSRA's purview is clearly very hard to get right. If we make changes in the area again we should try hard to represent it as normal IR. |
AndyAyersMS
approved these changes
Oct 29, 2025
This was referenced Oct 29, 2025
Open
Member
Author
|
/ba-g Helix timeout |
This was referenced Oct 31, 2025
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.
The code path assumed we didn't have tailcalls on x86, but we do see them for
CEE_JMPspecifically. In that case the GS cookie check may need a register in AOT scenarios, so give it one.Fix #121133