Fix in optimizer to always respect refkind of vararg arguments#26123
Merged
VSadov merged 5 commits intodotnet:masterfrom Apr 14, 2018
Merged
Fix in optimizer to always respect refkind of vararg arguments#26123VSadov merged 5 commits intodotnet:masterfrom
VSadov merged 5 commits intodotnet:masterfrom
Conversation
cston
reviewed
Apr 12, 2018
| if (i < parameters.Length) | ||
| /// <summary> | ||
| /// Computes the desired refkind of the argument. | ||
| /// Consiuders all the cases where ref kinds are explicit, omitted, vararg cases. |
cston
reviewed
Apr 12, 2018
|
|
||
| for (int i = 0; i < arguments.Length; i++) | ||
| { | ||
| RefKind refKind = argRefKindsOpt.IsDefaultOrEmpty ? RefKind.None : node.ArgumentRefKindsOpt[i]; |
Contributor
There was a problem hiding this comment.
node.ArgumentRefKindsOpt [](start = 83, length = 24)
argRefKindsOpt #Resolved
Member
Author
|
@dotnet/roslyn-compiler - please review |
Member
Author
|
Tests seems to pass locally. Perhaps some issues with CI (the errors do not make a lot of sense). |
Member
Author
|
Actually it looks like coreclr does not support varargs. |
OmarTawfik
reviewed
Apr 13, 2018
| public void VarargByRef() | ||
| { | ||
|
|
||
| var code = @" |
Contributor
There was a problem hiding this comment.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Optimizer has all the information about refkinds, but chooses not to use it for
__arglist. As a result vararg arguments are treated as always byval, which may allow optimizing them to stack values. That, in turns, result in byref arguments being effectively passed by value (and triggering an assert in codegen).This change makes optimizer use the refkinds of vararg arguments.
The bug is not recent, and the feature is not extremely popular, so fixing in v.Next / master seems appropriate.
Fixes:#26113