-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add array initialization optimization #62392
Conversation
5eb5c0d
to
852f380
Compare
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.
Overall this looks ready for review, just a few minor comments.
c728f3c
to
a901824
Compare
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.
One minor comment, otherwise this is looking good.
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 (commit 7). @dotnet/roslyn-compiler for a 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.
Is there any test where AllocateUninitializedArray
doesn't exist? This can be achieved by using MakeMemberMissing
in a test.
@333fred Does VB need a similar change? |
// Not always available. | ||
continue; | ||
} | ||
if (wkm == WellKnownMember.Count) continue; // Not a real value. |
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.
@333fred Is it expected the test pass without skipping WellKnownMember.Count
. That looks surprising to me.
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.
See line 915: this continue
is dead and will never be reached.
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.
Yes this isn't related to my change at all I just noticed this statement was redundant
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.
or yeah sorry unreachable I should say
Yes, you can do that via |
Yeah I didn't see |
src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs
Outdated
Show resolved
Hide resolved
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.
Done with review pass (iteration 7). Only some nits to consider and a couple questions
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 Thanks (iteration 8). Good to merge/squash
…tional test cases and finish updating broken unit tests
d8ffe6c
to
ed11f7c
Compare
* upstream/main: (40 commits) Revert "Generalize RoamingProfileStorageLocation to ClientSettingsStorageLocation (dotnet#62684)" Revert "Update SymReader to the latest version (dotnet#62695)" Apply changes directly to text buffer - take 2 (dotnet#62617) Allow diagnostic tagging to use either push or pull diagnostics Tests test and more tests Fix new rename showing overloads when not applicable (dotnet#62559) Add stronger type safety Add support for resolving contextual error types Pass LineFormatting options into OmniSharpCodeAction options Initial approach to supporting contextual types Update dependencies from https://github.com/dotnet/arcade build 20220715.4 (dotnet#62704) Handle diff3 conflict markers (dotnet#62391) Update SymReader to the latest version (dotnet#62695) Generalize RoamingProfileStorageLocation to ClientSettingsStorageLocation (dotnet#62684) Add IWorkspaceProjectContextFactory F# wappers (dotnet#62646) Use OmniSharp LineFormatting fallback options in more places. Remove dependency on Microsoft.VisualStudio.RemoteControl assembly from Features (dotnet#62655) Add array initialization optimization (dotnet#62392) [main] Update dependencies from dotnet/arcade (dotnet#62597) Keep selection on rename invocation (dotnet#62654) ...
* Add array initialization optimization fix and initial unit tests * fix: ensure indices are emitted for multidimensional arrays; add additional test cases and finish updating broken unit tests * Address pre-review comments * Remove extraneous whitespace * Avoid PEVerify bug for test IL output by changing test .NET version depending on execution context * Address final review comments and hopefully fix CI * Final changes to get CI to pass * Address additional review feedback
Addresses #61011. In the case where a 1-dimensional array is created with an initializer, emit a call to
System.GC.AllocateUninitializedArray
instead of anewarr
instruction to avoid performing an unnecessary zero-initialization.