[mono][interp] Sign extend I4 return value since jit-ed code expects it#117306
Closed
BrzVlad wants to merge 1 commit intodotnet:mainfrom
Closed
[mono][interp] Sign extend I4 return value since jit-ed code expects it#117306BrzVlad wants to merge 1 commit intodotnet:mainfrom
BrzVlad wants to merge 1 commit intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that 32-bit integer return values from interpreted methods on amd64 are sign-extended to match JIT expectations and updates the call-result widening logic to include the interpreter backend alongside LLVM.
- Sign-extend I4 return values in the amd64 interpreter call context.
- Extend
mono_emit_widen_call_resto treat the interpreter path similarly to LLVM for return-value widening.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/mono/mono/mini/mini-amd64.c | Sign-extend I4 return value on the amd64 interpreter path when returning in RAX. |
| src/mono/mono/mini/method-to-ir.c | Rename and extend the “might_use_llvm” flag to also cover the interpreter path. |
Comments suppressed due to low confidence (2)
src/mono/mono/mini/method-to-ir.c:2238
- Update this comment to mention that widening now applies for both LLVM and the interpreter backends, not just LLVM.
// LLVM code doesn't uses zero extend the full word while jit expects it.
src/mono/mono/mini/mini-amd64.c:1480
- Add a unit test for the interpreter on amd64 to verify that negative I4 return values are correctly sign-extended when placed in RAX.
if (sig->ret->type == MONO_TYPE_I4 && ainfo->storage == ArgInIReg && ainfo->reg == AMD64_RAX)
Contributor
|
Tagging subscribers to this area: @steveisok, @vitek-karas |
BrzVlad
commented
Jul 4, 2025
lateralusX
reviewed
Jul 4, 2025
This was referenced Jul 4, 2025
Open
Member
Author
|
Replaced by #117336 |
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.
Fixes #115859