-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[mono][mini] Fix conversion from r4/r8 to native u #85964
Merged
Merged
Conversation
This file contains 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
dotnet-issue-labeler
bot
added
the
needs-area-label
An area label is needed to ensure this gets routed to the appropriate area owners
label
May 9, 2023
ghost
assigned BrzVlad
May 9, 2023
BrzVlad
added
area-Codegen-JIT-mono
and removed
needs-area-label
An area label is needed to ensure this gets routed to the appropriate area owners
labels
May 9, 2023
This was referenced May 9, 2023
vargaz
reviewed
May 9, 2023
@@ -8992,7 +8995,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b | |||
if (sp [-1]->type == STACK_R8 || sp [-1]->type == STACK_R4) { | |||
/* floats are always signed, _UN has no effect */ | |||
ADD_UNOP (CEE_CONV_OVF_U8); | |||
ADD_UNOP (il_op); | |||
if (TARGET_SIZEOF_VOID_P == 8 && il_op == MONO_CEE_CONV_OVF_U) |
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.
This could be if (!(....)) ADD_UNOP..
vargaz
reviewed
May 9, 2023
vargaz
approved these changes
May 9, 2023
@BrzVlad - are CI failures related ? |
Yes but only happening on arm64 apparently. VM software would be useful here |
When converting from float point to unsigned integer, we always do a conversion to u8, then do a simple integer conversion with range checks. The problem is that the first conversion to u8 pushes a STACK_I8 and doing a further conversion to u8 is not actually a nop since it will throw if the result of the previous conversion is negative.
BrzVlad
force-pushed
the
fix-jit-conv-ovf
branch
from
June 19, 2023 07:50
5dd131e
to
be4d56b
Compare
These follow CoreCLR implementation and don't rely on undefined behavior from out of range conversions.
ghost
locked as resolved and limited conversation to collaborators
Jul 20, 2023
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.
When converting from float point to unsigned integer, we always do a conversion to u8, then do a simple integer conversion with range checks. The problem is that the first conversion to u8 pushes a STACK_I8 and doing a further conversion to u8 is not actually a nop since it will throw if the result of the previous conversion is negative.
Fixes #69794