Fix zero-extending displacement on win_x86_x64 JIT#117945
Merged
max-charlamb merged 2 commits intodotnet:mainfrom Jul 23, 2025
Merged
Fix zero-extending displacement on win_x86_x64 JIT#117945max-charlamb merged 2 commits intodotnet:mainfrom
max-charlamb merged 2 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a zero-extending issue in the x86_x64 JIT compiler that was causing crossgen2-comparison test failures. The issue occurred when comparing crossgen output targeting x86 from both x86 and x64 JITs, which produced different encodings due to incorrect displacement handling.
- Changed displacement variable type from
unsignedtointto properly handle sign extension - Ensures 32-bit displacement values are correctly sign-extended to 64-bit values instead of being zero-extended
- Prevents the JIT from incorrectly treating displacements as large positive numbers and using inefficient larger encodings
Member
Author
|
/azp list |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Member
Author
|
/azp run runtime-coreclr crossgen2 outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
|
cc @dotnet/jit-contrib |
Member
|
@max-charlamb The JIT codebase is auto-formatted. Could you please apply the auto-formatter patch from one of the failing formatter legs? |
Member
Author
|
/azp run runtime-coreclr crossgen2 outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
tannergooding
approved these changes
Jul 22, 2025
This was referenced Jul 23, 2025
Open
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.
Resolves #115661
crossgen2-comparison test comparing crossgen targeting x86 from a x86 and x64 JIT has been failing due to the x64 host JIT using different encodings.
I traced this back to a 32-bit displacement value not being sign extended to a 64-bit value. This caused the JIT to think the displacement was a large positive number and used a larger encoding.
Fixed by treating the displacement as a signed value.