Skip to content
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

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

AlekseyTs
Copy link
Contributor

Closes #63221.

@AlekseyTs AlekseyTs requested a review from a team as a code owner October 17, 2023 00:55
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Oct 17, 2023
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review

3 similar comments
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review

@AlekseyTs
Copy link
Contributor Author

@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.
Copy link
Member

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)

Suggested change
' 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)))
Copy link
Member

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.

Copy link
Contributor Author

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".

Comment on lines +332 to +333
' 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
' 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

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

5 similar comments
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

@RikkiGibson RikkiGibson self-assigned this Oct 30, 2023
Copy link
Contributor

@RikkiGibson RikkiGibson left a 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)
Copy link
Contributor

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.

@AlekseyTs AlekseyTs merged commit 0d04411 into dotnet:main Nov 1, 2023
25 checks passed
@ghost ghost added this to the Next milestone Nov 1, 2023
@RikkiGibson RikkiGibson modified the milestones: Next, 17.9 P2 Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CompoundAssignment.Bug1021941 fail in .net7p6
3 participants