-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Ensure proper receiver value is used for a constrained call invocation #70401
Conversation
@dotnet/roslyn-compiler Please review |
3 similar comments
@dotnet/roslyn-compiler Please review |
@dotnet/roslyn-compiler Please review |
@dotnet/roslyn-compiler Please review |
|
||
If referenceReceiverSpillSequence IsNot Nothing Then | ||
' If condition `(object)default(T) != null` is true at execution time, | ||
' the T Is a value type. And it is a reference type otherwise. |
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.
(applies to all occurrences of this comment)
' the T Is a value type. And it is a reference type otherwise. | |
' the T is a value type. And it is a reference type otherwise. |
' If condition `(object)default(T) != null` is true at execution time, | ||
' the T Is a value type. And it is a reference type otherwise. | ||
Dim isValueTypeCheck = Me.F.ReferenceIsNotNothing(Me.F.DirectCast(Me.F.DirectCast(Me.F.Null(), receiverType), | ||
Me.F.SpecialType(SpecialType.System_Object))) |
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.
Looks like this condition will be false
for nullable value types.
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.
Looks like this condition will be false for nullable value types.
Yes, but we can leave with that and make a copy of a nullable value type because today there is no other more accurate check that is going to be reliably recognized and removed along with the branch known to be false by JIT during specialization. Throughout both compilers we do not go into these details in comments to not "muddle the water".
' A case where T Is actually a class must be handled specially. | ||
' Taking a reference to a class instance Is fragile because the value behind the |
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.
' A case where T Is actually a class must be handled specially. | |
' Taking a reference to a class instance Is fragile because the value behind the | |
' A case where T is actually a class must be handled specially. | |
' Taking a reference to a class instance is fragile because the value behind the |
@dotnet/roslyn-compiler For the second review. |
5 similar comments
@dotnet/roslyn-compiler For the second review. |
@dotnet/roslyn-compiler For the second review. |
@dotnet/roslyn-compiler For the second review. |
@dotnet/roslyn-compiler For the second review. |
@dotnet/roslyn-compiler For the second review. |
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.
C# changes LGTM, but I need more time to get through the VB changes.
|
||
verifier.VerifyIL("Program.Shift1<T>", | ||
@" | ||
{ | ||
// Code size 46 (0x2e) | ||
// Code size 42 (0x2a) |
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.
nit: align leading indentation here to match the original version of the test.
Closes #63221.