-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Implement the unsigned-source overflowing conversions in the interpreter #116924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Noticed some other problems with our conversions so I'm going to clean them up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for unsigned-source overflow-checking conversions in the interpreter backend and corresponding compiler support, and adds a new unit test to validate these conversions.
- Introduces new
conv.u8.u4
and variousconv.ovf.*
opcodes inintops.def
- Extends
ConvOvfHelper
and opcode dispatch ininterpexec.cpp
to handle unsigned-source cases - Updates
compiler.cpp
to emit the new overflow opcodes for unsigned conversions - Adds
TestConvOvfUn
(and console logging) inInterpreter.cs
to cover unsigned overflow conversions
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/tests/JIT/interpreter/Interpreter.cs | Added TestConvOvfUn method and Console.WriteLine calls for clarity |
src/coreclr/vm/interpexec.cpp | Enhanced ConvOvfHelper to support growing conversions with sign changes and added unsigned conversion cases |
src/coreclr/interpreter/intops.def | Defined new unsigned-source overflow-checking opcodes |
src/coreclr/interpreter/compiler.cpp | Updated code generator to emit the new unsigned conversion opcodes |
Comments suppressed due to low confidence (2)
src/coreclr/interpreter/compiler.cpp:4078
- In the CEE_CONV_OVF_U_UN case on 32-bit targets, using INTOP_CONV_OVF_U4_I8 treats the source as signed. To properly implement 'un' (treat source as unsigned), replace this with INTOP_CONV_OVF_U4_U8.
#else
src/tests/JIT/interpreter/Interpreter.cs:1570
- [nitpick] Variables
a
,b
, andc
are non-descriptive; consider renaming them to clarify their purpose (e.g.,resultFromU2
,resultFromU4
,resultFromU8
).
byte a = (byte)u2,
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
@kg can you please resolve the conflict so that we can merge the change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Checkpoint Checkpoint Implement most of the unsigned source conversions Generalize ConvOvfHelper to support growing conversions as well Add some missing conv ovf opcodes Fix up ovf conversion mappings in compiler Fix copy paste error Fix copy-paste error Add missing check Remove no-op movs Remove no-op mov convs
I see "Merging is blocked: All comments must be resolved" but there are no unresolved comments on this PR. Does anyone know what causes that? EDIT: Copilot had marked some unresolved comments as "outdated", making them invisible. |
Uh oh!
There was an error while loading. Please reload this page.