Add array initialization optimization#62392
Conversation
5eb5c0d to
852f380
Compare
333fred
left a comment
There was a problem hiding this comment.
Overall this looks ready for review, just a few minor comments.
c728f3c to
a901824
Compare
333fred
left a comment
There was a problem hiding this comment.
One minor comment, otherwise this is looking good.
333fred
left a comment
There was a problem hiding this comment.
LGTM (commit 7). @dotnet/roslyn-compiler for a second review.
Youssef1313
left a comment
There was a problem hiding this comment.
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.
@333fred Is it expected the test pass without skipping WellKnownMember.Count. That looks surprising to me.
There was a problem hiding this comment.
See line 915: this continue is dead and will never be reached.
There was a problem hiding this comment.
Yes this isn't related to my change at all I just noticed this statement was redundant
There was a problem hiding this comment.
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
jcouv
left a comment
There was a problem hiding this comment.
Done with review pass (iteration 7). Only some nits to consider and a couple questions
jcouv
left a comment
There was a problem hiding this comment.
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.AllocateUninitializedArrayinstead of anewarrinstruction to avoid performing an unnecessary zero-initialization.