platform/upstream/dotnet/runtime.git
3 years agoFix JITEEInterface::IsValueClass to return false for pointers. (#50749)
Sergey Andreenko [Tue, 13 Apr 2021 07:42:50 +0000 (00:42 -0700)]
Fix JITEEInterface::IsValueClass to return false for pointers. (#50749)

* lets VM return `isValueClass=false` for pointers.

* fix assert and add a comment.

* fix diffs.

* fix crossgen2 part.

* Update JITEEVersionIdentifier.

3 years agoDelete `JitDoOldStructRetyping` artifacts. (#51092)
Sergey Andreenko [Tue, 13 Apr 2021 07:42:27 +0000 (00:42 -0700)]
Delete `JitDoOldStructRetyping` artifacts. (#51092)

* Delete `JitDoOldStructRetyping`.

* delete unnecessary spilling in `fgUpdateInlineReturnExpressionPlaceHolder`.

3 years agoFix the buffering bug that blocks SDK (#51151)
Adam Sitnik [Tue, 13 Apr 2021 06:56:38 +0000 (08:56 +0200)]
Fix the buffering bug that blocks SDK (#51151)

* add a failing test that mimcs the SDK bug

* fix the buffering bug

3 years ago[AndroidCrypto] Use new test certs for System.Net (#51143)
Elinor Fung [Tue, 13 Apr 2021 06:43:27 +0000 (23:43 -0700)]
[AndroidCrypto] Use new test certs for System.Net (#51143)

3 years agoGeneralize loop inversion (#50982)
Bruce Forstall [Tue, 13 Apr 2021 05:58:03 +0000 (22:58 -0700)]
Generalize loop inversion (#50982)

* Generalize loop inversion

Starting with an experimental branch from @AndyAyersMS,
generalize the loop inversion `optInvertWhileLoop` code
to consider duplicating an entire conditional block, not
just a conditional block that contains exactly one JTRUE
tree. Since the JTRUE itself wasn't considered before in
the costing, bump up the maximum cost allowed by 2 to account
for that. (Note that there is a lot of room here for tuning
the cost/benefit analysis.)

Additionally, the code already bumped the allowed cost if the
condition tree contained calls to a shared static helper. Add
another boost if the tree contains array.Length expressions,
which are likely to be CSE'ed.

Loop inversion by itself doesn't buy much, but our downstream
phases, like natural loop recognition, loop hoisting, and loop
cloning, depend on an inverted loop structure with a zero trip
test.

There are many diffs, typically size regressions because we
are duplicating code. Some notable cases:
1. BenchI Puzzle. This was a motivating example, from #6569.
It ends up with multiple new CSEs and BDN shows a 24% run-time
improvement.
2. RegexRedux_5 and ReverseComplement_1 also report faster
3. On the contrary, FannkuchRedux_5 reports 23% slower. It appears
we create fewer CSEs and end up with a couple more instructions
inside some tight loops.
4. Other things typically seen in diffs: (a) removed null and
bounds checks, (b) additional CSEs, (c) loop alignment kicks in.

The loop matching at the stage inversion runs is lexical and very
simplistic, as it is before natural loop recognition. As a result,
for some loops, like multiple-condition `while` loops (e.g.,
`while (--digits >= 0 || value != 0)` in
`System.Number:UInt32ToDecChars`), the inversion ends up creating
some pretty weird flow. (That's actually not new to this change.)

I added a `COMPlus_JitDoLoopInversion` config to allow turning
off the phase to do experiments.

Here are the diffs for SPMI on the benchmarks:
```

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 306240
Total bytes of diff: 306022
Total bytes of delta: -218 (-0.07% of base)
    diff is an improvement.
```
<details>

<summary>Detail diffs</summary>

```

Top file regressions (bytes):
         204 : 18210.dasm (13.98% of base)
         123 : 17149.dasm (3.84% of base)
         115 : 12617.dasm (1.95% of base)
         106 : 19256.dasm (5.92% of base)
         105 : 8717.dasm (8.19% of base)
          94 : 5445.dasm (9.49% of base)
          85 : 16452.dasm (1.48% of base)
          82 : 19234.dasm (12.01% of base)
          76 : 4626.dasm (20.05% of base)
          64 : 18620.dasm (6.97% of base)
          52 : 19202.dasm (16.20% of base)
          50 : 19210.dasm (3.15% of base)
          48 : 25971.dasm (0.66% of base)
          46 : 18490.dasm (6.05% of base)
          46 : 19131.dasm (8.44% of base)
          36 : 17812.dasm (1.84% of base)
          36 : 10409.dasm (4.20% of base)
          36 : 15922.dasm (17.48% of base)
          35 : 17997.dasm (11.18% of base)
          34 : 14621.dasm (4.82% of base)

Top file improvements (bytes):
        -557 : 18190.dasm (-19.94% of base)
        -525 : 18412.dasm (-12.80% of base)
        -260 : 18400.dasm (-19.89% of base)
        -202 : 17991.dasm (-16.67% of base)
        -201 : 20540.dasm (-18.91% of base)
        -200 : 18417.dasm (-9.96% of base)
        -159 : 17736.dasm (-7.87% of base)
        -128 : 18326.dasm (-7.15% of base)
         -90 : 18182.dasm (-4.71% of base)
         -67 : 18177.dasm (-3.94% of base)
         -59 : 18359.dasm (-5.13% of base)
         -53 : 20672.dasm (-8.02% of base)
         -53 : 18280.dasm (-10.77% of base)
         -45 : 18575.dasm (-8.08% of base)
         -42 : 16930.dasm (-7.89% of base)
         -40 : 17935.dasm (-4.77% of base)
         -38 : 17814.dasm (-2.11% of base)
         -38 : 18458.dasm (-4.87% of base)
         -36 : 18222.dasm (-3.07% of base)
         -36 : 18440.dasm (-6.75% of base)

376 total files with Code Size differences (153 improved, 223 regressed), 5 unchanged.

Top method regressions (bytes):
         204 (13.98% of base) : 18210.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamedTypeSymbol:MakeAcyclicInterfaces(Roslyn.Utilities.ConsList`1[[Microsoft.CodeAnalysis.CSharp.Symbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.DiagnosticBag):System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]:this
         123 ( 3.84% of base) : 17149.dasm - Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser:ParseNamespaceBody(byref,byref,byref,ushort):this
         115 ( 1.95% of base) : 12617.dasm - Utf8Json.Formatters.DictionaryFormatterBase`5[Int32,__Canon,__Canon,Enumerator,__Canon][System.Int32,System.__Canon,System.__Canon,System.Collections.Generic.Dictionary`2+Enumerator[System.Int32,System.__Canon],System.__Canon]:Serialize(byref,System.__Canon,Utf8Json.IJsonFormatterResolver):this
         106 ( 5.92% of base) : 19256.dasm - <Microsoft-Cci-ITypeDefinition-GetExplicitImplementationOverrides>d__31:MoveNext():bool:this
         105 ( 8.19% of base) : 8717.dasm - System.String:SplitWithPostProcessing(System.ReadOnlySpan`1[Int32],System.ReadOnlySpan`1[Int32],int,int,int):System.String[]:this
          94 ( 9.49% of base) : 5445.dasm - System.Uri:CreateUriInfo(long):this
          85 ( 1.48% of base) : 16452.dasm - DynamicClass:_DynamicMethod9(System.IO.TextReader,int):MicroBenchmarks.Serializers.MyEventsListerViewModel
          82 (12.01% of base) : 19234.dasm - <GetTopLevelTypesCore>d__53:MoveNext():bool:this
          76 (20.05% of base) : 4626.dasm - System.Collections.Generic.PriorityQueue`2[__Canon,__Canon][System.__Canon,System.__Canon]:MoveDownCustomComparer(System.ValueTuple`2[__Canon,__Canon],int):this
          64 ( 6.97% of base) : 18620.dasm - Microsoft.CodeAnalysis.CSharp.Binder:BindSimpleBinaryOperator(Microsoft.CodeAnalysis.CSharp.Syntax.BinaryExpressionSyntax,Microsoft.CodeAnalysis.DiagnosticBag):Microsoft.CodeAnalysis.CSharp.BoundExpression:this
          52 (16.20% of base) : 19202.dasm - <GetAssemblyReferencesFromAddedModules>d__36:MoveNext():bool:this
          50 ( 3.15% of base) : 19210.dasm - <GetTopLevelTypes>d__23[__Canon,__Canon,__Canon,__Canon,__Canon,__Canon,__Canon,__Canon,__Canon][System.__Canon,System.__Canon,System.__Canon,System.__Canon,System.__Canon,System.__Canon,System.__Canon,System.__Canon,System.__Canon]:MoveNext():bool:this
          48 ( 0.66% of base) : 25971.dasm - DynamicClass:_DynamicMethod1(System.IO.TextReader,int):MicroBenchmarks.Serializers.CollectionsOfPrimitives
          46 ( 6.05% of base) : 18490.dasm - Microsoft.CodeAnalysis.CSharp.ClsComplianceChecker:VisitAssembly(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol):this
          46 ( 8.44% of base) : 19131.dasm - <AddedModulesResourceNames>d__200:MoveNext():bool:this
          36 ( 1.84% of base) : 17812.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamespaceSymbol:MakeNameToMembersMap(Microsoft.CodeAnalysis.DiagnosticBag):System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
          36 ( 4.20% of base) : 10409.dasm - System.Net.Security.SslStream:FillHandshakeBufferAsync(System.Net.Security.AsyncReadWriteAdapter,int):System.Threading.Tasks.ValueTask`1[Int32]:this
          36 (17.48% of base) : 15922.dasm - System.Number:DecimalToNumber(byref,byref)
          35 (11.18% of base) : 17997.dasm - <CreateNestedTypes>d__126:MoveNext():bool:this
          34 ( 4.82% of base) : 14621.dasm - BenchmarksGame.KNucleotide_1:Bench(System.IO.Stream,BenchmarksGame.NucleotideHelpers,bool):bool

Top method improvements (bytes):
        -557 (-19.94% of base) : 18190.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamedTypeSymbol:MakeDeclaredBases(Roslyn.Utilities.ConsList`1[[Microsoft.CodeAnalysis.CSharp.Symbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.DiagnosticBag):System.Tuple`2[[Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
        -525 (-12.80% of base) : 18412.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:ComputeInterfaceImplementations(Microsoft.CodeAnalysis.DiagnosticBag,System.Threading.CancellationToken):System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.SynthesizedExplicitImplementationForwardingMethod, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]:this
        -260 (-19.89% of base) : 18400.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.OverriddenOrHiddenMembersHelpers:FindOverriddenOrHiddenMembersInType(Microsoft.CodeAnalysis.CSharp.Symbol,bool,Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol,Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol,byref,byref,byref)
        -202 (-16.67% of base) : 17991.dasm - Microsoft.CodeAnalysis.CSharp.CSharpCompilation:GetRuntimeMember(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol,byref,Microsoft.CodeAnalysis.RuntimeMembers.SignatureComparer`5[[Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol):Microsoft.CodeAnalysis.CSharp.Symbol
        -201 (-18.91% of base) : 20540.dasm - Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel:GetDeclaredMember(Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol,Microsoft.CodeAnalysis.Text.TextSpan,System.String):Microsoft.CodeAnalysis.CSharp.Symbol:this
        -200 (-9.96% of base) : 18417.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:CheckMemberNameConflicts(Microsoft.CodeAnalysis.DiagnosticBag):this
        -159 (-7.87% of base) : 17736.dasm - Microsoft.CodeAnalysis.CSharp.CSharpCompilation:GetDiagnostics(int,bool,Microsoft.CodeAnalysis.DiagnosticBag,System.Threading.CancellationToken):this
        -128 (-7.15% of base) : 18326.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:MakeTypeMembers(Microsoft.CodeAnalysis.DiagnosticBag):System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
         -90 (-4.71% of base) : 18182.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamedTypeSymbol:PostDecodeWellKnownAttributes(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.CSharpAttributeData, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Syntax.AttributeSyntax, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.DiagnosticBag,short,Microsoft.CodeAnalysis.WellKnownAttributeData):this
         -67 (-3.94% of base) : 18177.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:ForceComplete(Microsoft.CodeAnalysis.SourceLocation,System.Threading.CancellationToken):this
         -59 (-5.13% of base) : 18359.dasm - Microsoft.CodeAnalysis.CSharp.Binder:ValidateParameterNameConflicts(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.TypeParameterSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.DiagnosticBag):this
         -53 (-8.02% of base) : 20672.dasm - Microsoft.CodeAnalysis.CSharp.Imports:LookupSymbolInUsings(System.Collections.Immutable.ImmutableArray`1[NamespaceOrTypeAndUsingDirective],Microsoft.CodeAnalysis.CSharp.Binder,Microsoft.CodeAnalysis.CSharp.LookupResult,System.String,int,Roslyn.Utilities.ConsList`1[[Microsoft.CodeAnalysis.CSharp.Symbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],int,bool,byref)
         -53 (-10.77% of base) : 18280.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol:GetSourceTypeMember(System.String,int,ushort,Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode):Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamedTypeSymbol:this
         -45 (-8.08% of base) : 18575.dasm - Microsoft.CodeAnalysis.CSharp.ExecutableCodeBinder:ValidateIteratorMethods(Microsoft.CodeAnalysis.DiagnosticBag):this
         -42 (-7.89% of base) : 16930.dasm - V8.Crypto.BigInteger:fromByteArray(System.Byte[]):this
         -40 (-4.77% of base) : 17935.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol:LookupMetadataType(byref):Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol:this
         -38 (-2.11% of base) : 17814.dasm - Microsoft.CodeAnalysis.CSharp.MergedNamespaceDeclaration:MakeChildren():System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.MergedNamespaceOrTypeDeclaration, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]:this
         -38 (-4.87% of base) : 18458.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberMethodSymbol:ForceComplete(Microsoft.CodeAnalysis.SourceLocation,System.Threading.CancellationToken):this
         -36 (-3.07% of base) : 18222.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:MakeAllMembers(Microsoft.CodeAnalysis.DiagnosticBag):System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
         -36 (-6.75% of base) : 18440.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:CheckTypeParameterNameConflicts(Microsoft.CodeAnalysis.DiagnosticBag):this

Top method regressions (percentages):
          17 (36.17% of base) : 22943.dasm - System.Collections.IndexerSetReverse`1[Int32][System.Int32]:Array():System.Int32[]:this
          17 (36.17% of base) : 24496.dasm - System.Collections.IndexerSetReverse`1[__Canon][System.__Canon]:Array():System.__Canon[]:this
          18 (27.27% of base) : 13842.dasm - System.Collections.IterateFor`1[__Canon][System.__Canon]:Get(System.Collections.Generic.IList`1[__Canon]):System.__Canon:this
          15 (26.79% of base) : 13055.dasm - System.Number:UInt32ToDecChars(long,int,int):long
          15 (25.86% of base) : 975.dasm - System.Number:UInt32ToDecChars(long,int,int):long
          16 (25.81% of base) : 20092.dasm - System.Collections.IndexerSet`1[__Canon][System.__Canon]:Set(System.Collections.Generic.IList`1[__Canon]):System.Collections.Generic.IList`1[__Canon]:this
          22 (25.58% of base) : 9613.dasm - System.Xml.XmlLoader:LoadDocSequence(System.Xml.XmlDocument):this
          18 (25.35% of base) : 11926.dasm - EMFloatClass:normalize(InternalFPF)
          14 (22.95% of base) : 25097.dasm - V8.Richards.Packet:addTo(V8.Richards.Packet):V8.Richards.Packet:this
          16 (21.92% of base) : 4954.dasm - System.IO.Compression.DeflateStream:WriteDeflaterOutput():this
          10 (20.41% of base) : 27331.dasm - System.Collections.IterateFor`1[Int32][System.Int32]:ImmutableList():int:this
          10 (20.41% of base) : 9944.dasm - System.Collections.IterateFor`1[Int32][System.Int32]:ImmutableSortedSet():int:this
          76 (20.05% of base) : 4626.dasm - System.Collections.Generic.PriorityQueue`2[__Canon,__Canon][System.__Canon,System.__Canon]:MoveDownCustomComparer(System.ValueTuple`2[__Canon,__Canon],int):this
          10 (20.00% of base) : 14834.dasm - System.Collections.IterateFor`1[__Canon][System.__Canon]:ImmutableList():System.__Canon:this
          10 (20.00% of base) : 15485.dasm - System.Collections.IterateFor`1[__Canon][System.__Canon]:ImmutableSortedSet():System.__Canon:this
          24 (19.05% of base) : 8484.dasm - System.Collections.IterateForEach`1[__Canon][System.__Canon]:ImmutableArray():System.__Canon:this
          17 (18.09% of base) : 11992.dasm - Newtonsoft.Json.Utilities.DateTimeUtils:CopyIntToCharArray(System.Char[],int,int,int)
           9 (18.00% of base) : 19831.dasm - System.Reflection.Metadata.Ecma335.MetadataSizes:CalculateTableStreamHeaderSize():int:this
          16 (17.98% of base) : 4541.dasm - System.Collections.IndexerSetReverse`1[__Canon][System.__Canon]:Span():System.__Canon:this
          36 (17.48% of base) : 15922.dasm - System.Number:DecimalToNumber(byref,byref)

Top method improvements (percentages):
         -19 (-28.79% of base) : 18465.dasm - Microsoft.CodeAnalysis.CSharp.MergedTypeDeclaration:get_AnyMemberHasAttributes():bool:this
        -557 (-19.94% of base) : 18190.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamedTypeSymbol:MakeDeclaredBases(Roslyn.Utilities.ConsList`1[[Microsoft.CodeAnalysis.CSharp.Symbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.DiagnosticBag):System.Tuple`2[[Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
        -260 (-19.89% of base) : 18400.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.OverriddenOrHiddenMembersHelpers:FindOverriddenOrHiddenMembersInType(Microsoft.CodeAnalysis.CSharp.Symbol,bool,Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol,Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol,byref,byref,byref)
         -30 (-19.35% of base) : 19588.dasm - Microsoft.Cci.MetadataWriter:MayUseSmallExceptionHeaders(System.Collections.Immutable.ImmutableArray`1[[Microsoft.Cci.ExceptionHandlerRegion, Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):bool
        -201 (-18.91% of base) : 20540.dasm - Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel:GetDeclaredMember(Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol,Microsoft.CodeAnalysis.Text.TextSpan,System.String):Microsoft.CodeAnalysis.CSharp.Symbol:this
         -11 (-16.92% of base) : 18912.dasm - Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator:EmitStatements(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.BoundStatement, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-16.92% of base) : 18800.dasm - Microsoft.CodeAnalysis.CSharp.DataFlowPass:DeclareVariables(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.LocalSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-16.92% of base) : 18812.dasm - Microsoft.CodeAnalysis.CSharp.DataFlowPass:ReportUnusedVariables(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.LocalFunctionSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
        -202 (-16.67% of base) : 17991.dasm - Microsoft.CodeAnalysis.CSharp.CSharpCompilation:GetRuntimeMember(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol,byref,Microsoft.CodeAnalysis.RuntimeMembers.SignatureComparer`5[[Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol):Microsoft.CodeAnalysis.CSharp.Symbol
         -11 (-16.18% of base) : 20764.dasm - Microsoft.CodeAnalysis.CSharp.AbstractRegionDataFlowPass:MakeSlots(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-15.94% of base) : 19532.dasm - Microsoft.Cci.MetadataVisitor:Visit(System.Collections.Immutable.ImmutableArray`1[[Microsoft.Cci.IParameterDefinition, Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-15.71% of base) : 19548.dasm - Microsoft.Cci.MetadataVisitor:Visit(System.Collections.Immutable.ImmutableArray`1[[Microsoft.Cci.ILocalDefinition, Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-15.71% of base) : 19553.dasm - Microsoft.Cci.MetadataVisitor:Visit(System.Collections.Immutable.ImmutableArray`1[[Microsoft.Cci.ExceptionHandlerRegion, Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-15.71% of base) : 19457.dasm - Microsoft.Cci.MetadataVisitor:Visit(System.Collections.Immutable.ImmutableArray`1[[Microsoft.Cci.IParameterTypeInformation, Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-15.71% of base) : 19459.dasm - Microsoft.Cci.MetadataVisitor:Visit(System.Collections.Immutable.ImmutableArray`1[[Microsoft.Cci.ICustomModifier, Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-15.49% of base) : 18811.dasm - Microsoft.CodeAnalysis.CSharp.DataFlowPass:ReportUnusedVariables(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.LocalSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-15.07% of base) : 18797.dasm - Microsoft.CodeAnalysis.CSharp.DataFlowPass:EnterParameters(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -11 (-15.07% of base) : 20750.dasm - Microsoft.CodeAnalysis.CSharp.PreciseAbstractFlowPass`1[LocalState][Microsoft.CodeAnalysis.CSharp.DataFlowPass+LocalState]:VisitMultipleLocalDeclarations(Microsoft.CodeAnalysis.CSharp.BoundMultipleLocalDeclarations):Microsoft.CodeAnalysis.CSharp.BoundNode:this
         -11 (-15.07% of base) : 18768.dasm - Microsoft.CodeAnalysis.CSharp.PreciseAbstractFlowPass`1[LocalState][Microsoft.CodeAnalysis.CSharp.ControlFlowPass+LocalState]:VisitStatements(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.CSharp.BoundStatement, Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]):this
         -12 (-13.64% of base) : 18415.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:CheckMemberNamesDistinctFromType(Microsoft.CodeAnalysis.DiagnosticBag):this

376 total methods with Code Size differences (153 improved, 223 regressed), 5 unchanged.

```

</details>

--------------------------------------------------------------------------------

Additionally, I removed some dead "optimization enabling" code.

* Code review feedback: fix one condition

3 years agoImprove flowgraph xml/dot dumping (#51082)
Bruce Forstall [Tue, 13 Apr 2021 05:57:25 +0000 (22:57 -0700)]
Improve flowgraph xml/dot dumping (#51082)

* Improve flowgraph xml/dot dumping

1. Decouple it from JitDump
2. Add some documentation, including a useful link to https://sketchviz.com/
3. Fix DUMP_FLOWGRAPHS Release build
4. Fix some xml dumping issues
5. Replace custom function pattern parsing with CONFIG_METHODSET ".contains" function
6. Make dot format the default (instead of xml)

Fixes #43712

* Code review feedback: use `getCalledCount`

3 years agoAvoid intermediate allocations in MethodInfo/ConstructorInfo.Invoke (#50814)
Levi Broderick [Tue, 13 Apr 2021 05:45:40 +0000 (22:45 -0700)]
Avoid intermediate allocations in MethodInfo/ConstructorInfo.Invoke (#50814)

* Avoid temporary array allocations in reflection

* Add nullability annotations

* Move some lazy property getters out of the hot path

* More factoring out common fast paths

* Comment cleanup - no functional changes

* Moved some function blocks around for clarity - no functional changes

* Pass span into native stack byref

* Knock max stackalloced ctor parameters back to 4

* Move all CheckConsistency logic inline

3 years agoFix race in ComWrappers test (#51153)
Aaron Robinson [Tue, 13 Apr 2021 05:22:37 +0000 (22:22 -0700)]
Fix race in ComWrappers test (#51153)

Since the finalizer thread runs async with the test, we need to
atomically decrement the static instance counter.

3 years agoRely on initial pthread_jit_write_protect_np state (#51135)
Steve MacLean [Tue, 13 Apr 2021 00:57:00 +0000 (20:57 -0400)]
Rely on initial pthread_jit_write_protect_np state (#51135)

3 years agoAdd support in comhost tooling to embed type libraries. (#50986)
Jeremy Koritzinsky [Tue, 13 Apr 2021 00:10:48 +0000 (17:10 -0700)]
Add support in comhost tooling to embed type libraries. (#50986)

* Add support in comhost tooling to embed type libraries.

Sdk work will still be needed to enable developers to embed tlbs in their comhosts.

* Cleanup.

* PR feedback. Update validation to throw specific exception types for specific errors so the SDK can accurately report errors to the user.

3 years agoFix some memory attributions (#51065)
Bruce Forstall [Mon, 12 Apr 2021 23:29:43 +0000 (16:29 -0700)]
Fix some memory attributions (#51065)

* Fix some memory attributions

This doesn't change the memory stats greatly, overall.

* Formatting

3 years agoAdd ConfigurationKeyNameAttribute to binder and updated tests. (#50338)
Rob Lindley [Mon, 12 Apr 2021 23:19:04 +0000 (18:19 -0500)]
Add ConfigurationKeyNameAttribute to binder and updated tests. (#50338)

3 years ago[mono] Remove owns_vtable_slot (), its incorrect, and its not needed any more. (...
Zoltan Varga [Mon, 12 Apr 2021 21:21:54 +0000 (17:21 -0400)]
[mono] Remove owns_vtable_slot (), its incorrect, and its not needed any more. (#51127)

Fixes https://github.com/dotnet/runtime/issues/51109.

3 years agoFix EMITTER_STATS build (#51063)
Bruce Forstall [Mon, 12 Apr 2021 19:14:23 +0000 (12:14 -0700)]
Fix EMITTER_STATS build (#51063)

3 years agoRemove CSE ifdefs (#51043)
Bruce Forstall [Mon, 12 Apr 2021 19:13:54 +0000 (12:13 -0700)]
Remove CSE ifdefs (#51043)

* Remove CSE ifdefs

`FEATURE_ANYCSE` and `FEATURE_VALNUM_CSE` are always enabled, and
are expected to remain so, so remove the ifdefs.

* Formatting

3 years agoFix minimum iOS/tvOS version and add iOS 14 to RID graph (#50167)
Alexander Köplinger [Mon, 12 Apr 2021 18:13:39 +0000 (20:13 +0200)]
Fix minimum iOS/tvOS version and add iOS 14 to RID graph (#50167)

As specified in https://github.com/dotnet/runtime/issues/44654 the minimum iOS/tvOS version we're targeting for .NET 6 is iOS 10.
Bump the versions used in our build scripts and RID graph to that and also add iOS 14.

3 years agoMake it clearer what internal TimersDescriptionAttribute ctor is for (#51075)
Marek Safar [Mon, 12 Apr 2021 18:10:14 +0000 (20:10 +0200)]
Make it clearer what internal TimersDescriptionAttribute ctor is for (#51075)

3 years agoCall used comparer directly instead of non-generic Compare wrapper (#51001)
Marek Safar [Mon, 12 Apr 2021 18:07:06 +0000 (20:07 +0200)]
Call used comparer directly instead of non-generic Compare wrapper (#51001)

3 years agoAdd IL Offset and Method Token to stacktrace (#44013)
ws77.cho [Mon, 12 Apr 2021 17:56:45 +0000 (02:56 +0900)]
Add IL Offset and Method Token to stacktrace (#44013)

* Add IL Offset and Method Token to stacktrace

For easier debugging, if the PDB is not deployed, add the Method Token and IL Offset to the stacktrace.
This functionality can be turned on and off by environment setting "COMPlus_ILOffsetToStackTrace"

* Use LocalAppContextSwitch and HexConverter

Use LocalAppContextSwitch to get environment variable without using static constructor in StackTrace.
Also, use HexConverter to get metadata token and il offset without unnecessary complex.

* Use AppendFormat instead of HexConverter

Use AppendFormat() for formatting of the hex number.

* Use switch to activate ILOffset in stacktrace

- Change switch name from ILOffsetsToStackTrace to ShowILOffset
- Use "Switch.System.Diagnostics.StackTrace.ShowILOffsets" to activate ILOffset in stacktrace
- Use "DOTNET_" prefix for environment variable name (DOTNET_ILOffsetToStackTrace)

* Use AppContextConfigHelper for get switch value

* Add test case for ILOffsetToStackTrace

* Remove unused variable

* Use RemoteExecutor.Invoke for testing

* Update src/libraries/System.Private.CoreLib/src/System/LocalAppContextSwitches.cs

Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
* TC contents are added

* Remove setting code using enviornment variable

remove setting code using environment variable and change switch default value to true.

* code clean-up. remove unused code

* Sort using statements

* Skipt test in mono interpreter mode.

Related issue : https://github.com/dotnet/runtime/issues/51096

Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
3 years ago[wasm][tests] Enable line numbers in stack traces (#50893)
Ankit Jain [Mon, 12 Apr 2021 17:01:25 +0000 (13:01 -0400)]
[wasm][tests] Enable line numbers in stack traces (#50893)

3 years agoUse nuget standardized properties (#51014)
Viktor Hofer [Mon, 12 Apr 2021 16:37:58 +0000 (18:37 +0200)]
Use nuget standardized properties (#51014)

* Use nuget standardized properties

Requires https://github.com/dotnet/arcade/pull/7212. Helps with the pkgproj to csproj conversion.

3 years agotesting Unicode roundtrip (#51105)
Pavel Savara [Mon, 12 Apr 2021 16:37:16 +0000 (18:37 +0200)]
testing Unicode roundtrip (#51105)

* testing unicode roundtrip

* code review feedback

* fix Narrow No-Break Space

3 years ago[main] Update dependencies from dotnet/runtime dotnet/runtime-assets (#51110)
dotnet-maestro[bot] [Mon, 12 Apr 2021 16:35:30 +0000 (16:35 +0000)]
[main] Update dependencies from dotnet/runtime dotnet/runtime-assets (#51110)

[main] Update dependencies from dotnet/runtime dotnet/runtime-assets

3 years agoSystem.Text.Json: Add IAsyncEnumerable support (#50778)
Eirik Tsarpalis [Mon, 12 Apr 2021 16:06:01 +0000 (17:06 +0100)]
System.Text.Json: Add IAsyncEnumerable support (#50778)

* implement IAsyncEnumerable JsonConverter

* Prototype of IAsyncEnumerable deserialize with Stream

* Use a Queue + test buffersizes

* Avoid 1 item lag

* Add support for Serialize

* Misc cleanup on test

* extend DeserializeAsyncEnumerable test coverage

also removes SerializeAsyncEnumerable components

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/IAsyncEnumerableConverterFactory.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* address feedback

* tweak test buffer values

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/IAsyncEnumerableOfTConverter.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/IAsyncEnumerableOfTConverter.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* address feedback

* increase delayInterval in serialization tests

* address feedback

* address feedback

* add test on exceptional IAsyncDisposable disposal

* address feedback

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/ReadAsyncState.cs

Co-authored-by: Layomi Akinrinade <layomia@gmail.com>
* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs

Co-authored-by: Layomi Akinrinade <layomia@gmail.com>
* fix build and remove dead code

* address feedback

* Revert unneeded JsonClassInfo.ElementType workaround

* remove state allocation on async deserialization methods

* remove tooling artifacts

* address feedback

* reset AsyncEnumeratorIsPendingCompletion field

Co-authored-by: Steve Harter <steveharter@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Layomi Akinrinade <layomia@gmail.com>
3 years agoPass CORINFO_CALLINFO_ALLOWINSTPARAM to speculative eeGetCallInfo to make it cheaper...
Jan Kotas [Mon, 12 Apr 2021 15:26:15 +0000 (05:26 -1000)]
Pass CORINFO_CALLINFO_ALLOWINSTPARAM to speculative eeGetCallInfo to make it cheaper (#51088)

3 years agomake emsdk installation instructions clear on which version need to be installed...
Pavel Savara [Mon, 12 Apr 2021 15:17:20 +0000 (17:17 +0200)]
make emsdk installation instructions clear on which version need to be installed (#51071)

* make emsdk installation instructions clear on which version need to be installed

* whitespace

* Radek's feedback

3 years agoRevert "Switch to VS preview pool for public builds (#50993)" (#51103)
Alexander Köplinger [Mon, 12 Apr 2021 14:15:13 +0000 (16:15 +0200)]
Revert "Switch to VS preview pool for public builds (#50993)" (#51103)

3 years agoPrint Native Stacktrace on mono_llvm_cpp_throw_exception when profiler is enabled...
Thays Grazia [Mon, 12 Apr 2021 13:43:17 +0000 (10:43 -0300)]
Print Native Stacktrace on mono_llvm_cpp_throw_exception when profiler is enabled. (#51026)

* Print call stack when profile is enabled in a mono_llvm_cpp_throw_exception (void) this was asked by @jeromelaban

* Update src/mono/mono/mini/llvm-runtime.cpp

Co-authored-by: Jérôme Laban <jlaban@gmail.com>
* As suggested by @jeromelaban

Co-authored-by: Jérôme Laban <jlaban@gmail.com>
3 years agoInclude Mono in the name of all Mono runtime packs (#50327)
Steve Pfister [Mon, 12 Apr 2021 13:32:33 +0000 (09:32 -0400)]
Include Mono in the name of all Mono runtime packs (#50327)

We previously only used this naming on platforms that already had coreclr as an option. Using Mono in the name all the time will make what runtime you're dealing with less ambiguous.

Fixes #49718

3 years agoFix DispatchProxy not working with in parameters (#49214)
Wei Zheng [Mon, 12 Apr 2021 10:25:24 +0000 (18:25 +0800)]
Fix DispatchProxy not working with in parameters (#49214)

* Fix DispatchProxy not working with in parameters

* Correct typo

Co-authored-by: Christopher Watford <christopher.watford@ge.com>
* Fixed Calling Convention

Removed unneeded mods

Co-authored-by: Christopher Watford <christopher.watford@ge.com>
3 years agoAdd ILLink annotations to Microsoft.CSharp (#50239)
Krzysztof Wicher [Mon, 12 Apr 2021 10:09:47 +0000 (12:09 +0200)]
Add ILLink annotations to Microsoft.CSharp (#50239)

* Add ILLink annotations to Microsoft.CSharp

* apply PR feedback

* Apply PR feedback

* Fix missed comment

* apply pr feedback

3 years agoRun processenvironment test in separate process. (#51022)
Johan Lorensson [Mon, 12 Apr 2021 06:16:39 +0000 (08:16 +0200)]
Run processenvironment test in separate process. (#51022)

3 years agoFix handling of unmanaged member function pointers in Crossgen2 (#51089)
Tomáš Rylek [Mon, 12 Apr 2021 01:31:06 +0000 (18:31 -0700)]
Fix handling of unmanaged member function pointers in Crossgen2 (#51089)

Fixes: https://github.com/dotnet/runtime/issues/51007

Without setting found to true we lose the transformed calling
convention (StdcallMemberFunction) and we end up lying to JIT
that getSize is an unmanaged static function pointer so that
JIT doesn't emit proper code for passing the "this" pointer
to the PInvoke.

Thanks

Tomas

3 years agoCast to uint instead of nuint in {ReadOnly}Span.{Try}CopyTo (#51083)
Stephen Toub [Sun, 11 Apr 2021 21:30:47 +0000 (17:30 -0400)]
Cast to uint instead of nuint in {ReadOnly}Span.{Try}CopyTo (#51083)

3 years agoAdd internal String.{Try}CopyTo and use in a few places in corelib (#51062)
Stephen Toub [Sun, 11 Apr 2021 17:52:54 +0000 (13:52 -0400)]
Add internal String.{Try}CopyTo and use in a few places in corelib (#51062)

* Add internal String.{Try}CopyTo and use in a few places in corelib

We can use in more if it's made public.

* Apply suggestions from code review

Co-authored-by: Levi Broderick <GrabYourPitchforks@users.noreply.github.com>
Co-authored-by: Levi Broderick <GrabYourPitchforks@users.noreply.github.com>
3 years agoSimplify RuntimeType.ClearCache (#51070)
Jan Kotas [Sun, 11 Apr 2021 17:52:44 +0000 (07:52 -1000)]
Simplify RuntimeType.ClearCache (#51070)

3 years ago[main] Update dependencies from dotnet/arcade (#51074)
dotnet-maestro[bot] [Sun, 11 Apr 2021 16:51:34 +0000 (16:51 +0000)]
[main] Update dependencies from dotnet/arcade (#51074)

[main] Update dependencies from dotnet/arcade

 - revert changes to publish-using-darc.ps1

https://github.com/dotnet/arcade/issues/6987

3 years agoMove some Marshal functions to shared partition (#51045)
John Tur [Sun, 11 Apr 2021 09:02:43 +0000 (05:02 -0400)]
Move some Marshal functions to shared partition (#51045)

3 years agosome small proxy-related fixes (#50770)
Geoff Kizer [Sun, 11 Apr 2021 08:40:06 +0000 (01:40 -0700)]
some small proxy-related fixes (#50770)

* add tests

* add and use DoProxyAuth

* don't apply max connections to ProxyConnect connections

* make DoProxyAuth a property

* disable WinHttpHandler for new tests

* improve test robustness

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoFix Random.Next(int, int) on 64-bit when max-min overflows int.MaxValue (#50922)
Stephen Toub [Sun, 11 Apr 2021 02:59:43 +0000 (22:59 -0400)]
Fix Random.Next(int, int) on 64-bit when max-min overflows int.MaxValue (#50922)

* Fix Random.Next(int, int) on 64-bit when max-min overflow int

The fix is a missing cast.  Everything else is asserts and test changes.

* Update Random.cs

3 years agoAdd a dummy item to SingleFileHostIncludeFilename to make sure the opt-in list is...
Vladimir Sadov [Sun, 11 Apr 2021 02:13:09 +0000 (19:13 -0700)]
Add a dummy item to SingleFileHostIncludeFilename to make sure the opt-in list is present. (#51030)

3 years agoJIT: fix osr gc info this reporting (#51057)
Andy Ayers [Sun, 11 Apr 2021 01:03:39 +0000 (18:03 -0700)]
JIT: fix osr gc info this reporting (#51057)

With the advent of #38229 an optimized method may need to report generics
context via `this` while the un-optimzed version did not need to report.

This impacts OSR, which previously was always trying to use the unoptimized
root method frame reporting. Now under OSR we must sometimes add a slot to
the OSR frame instead.

Addresses one of the failure cases in #43534.

3 years ago[main] Update dependencies from dotnet/xharness dotnet/runtime-assets (#51049)
dotnet-maestro[bot] [Sat, 10 Apr 2021 23:56:09 +0000 (19:56 -0400)]
[main] Update dependencies from dotnet/xharness dotnet/runtime-assets (#51049)

* Update dependencies from https://github.com/dotnet/xharness build 20210409.2

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21207.1 -> To Version 1.0.0-prerelease.21209.2

* Update dependencies from https://github.com/dotnet/runtime-assets build 20210409.2

System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Windows.Extensions.TestData
 From Version 6.0.0-beta.21174.2 -> To Version 6.0.0-beta.21209.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years ago[AndroidCrypto] Handle setting non-default SslProtocols (#50987)
Elinor Fung [Sat, 10 Apr 2021 17:45:47 +0000 (10:45 -0700)]
[AndroidCrypto] Handle setting non-default SslProtocols (#50987)

3 years agoUpdate logic around BB_MAX_WEIGHT (#51027)
Andy Ayers [Sat, 10 Apr 2021 16:16:15 +0000 (09:16 -0700)]
Update logic around BB_MAX_WEIGHT (#51027)

Consider any weight greater or equal to be a max weight. Rule of thumb
is that you can assign BB_MAX_WEIGHT but for comparsions one should always
use an inequality or call the helper method.

Fixes #50808.

3 years agoMake composite MVID checks resilient to failures (#51018)
Tomáš Rylek [Sat, 10 Apr 2021 10:16:36 +0000 (03:16 -0700)]
Make composite MVID checks resilient to failures (#51018)

I noticed that several ALC-related CoreCLR tests fail in Crossgen2
composite mode. I tracked this down to a missing null check.
In addition to that, we were erroneously putting the composite
image to the validation list even when it had been loaded previously.

Thanks

Tomas

3 years agochange GC committed bytes unit to MB (#51031)
Sung Yoon Whang [Sat, 10 Apr 2021 07:45:34 +0000 (00:45 -0700)]
change GC committed bytes unit to MB (#51031)

* change GC committed bytes unit to MB

* change other memory counters to use 1_000_000

3 years agoFix incremental CMake command line check on Windows (#51035)
Jeremy Koritzinsky [Sat, 10 Apr 2021 04:12:48 +0000 (21:12 -0700)]
Fix incremental CMake command line check on Windows (#51035)

3 years agoFixed regression caused by performance change (#51032)
David Fowler [Sat, 10 Apr 2021 04:03:04 +0000 (21:03 -0700)]
Fixed regression caused by performance change (#51032)

- Pass empty array instead of null for validations

3 years agoAdd CI validation leg for source-build against an image with the tools our source...
Jeremy Koritzinsky [Sat, 10 Apr 2021 03:39:24 +0000 (20:39 -0700)]
Add CI validation leg for source-build against an image with the tools our source-build partners use to ensure we don't break our source-build partners. (#50811)

* Add CI validation leg for source-build against an image with the tools our source-build partners use to ensure we don't break our source-build partners.

* Update global-build.yml

* Update global-build.yml

* Update centos image.

* Explicitly invoke scl enable llvm-toolset-7.0 since docker doesn't do it for command executed in a running container.

* Skip mono in the source-build build.

* Set param in platform-matrix.yml

3 years agoInstall crossgen, jitinterface, clrjit into the sharedframework folder in crosscompon...
Jeremy Koritzinsky [Sat, 10 Apr 2021 01:15:26 +0000 (18:15 -0700)]
Install crossgen, jitinterface, clrjit into the sharedframework folder in crosscomponent build. (#51004)

* Install crossgen, jitinterface, clrjit into the sharedframework folder.

* Remove unneeded dependency

* Add dac/dbi to cross-component sharedFramework folder.

* Don't install the cross-os dac in crosscomponents in cross-bitness scenarios.

* Jit Interface doesn't need to go into the sharedFramework folder (it wasn't there in 6.0.0p3)

3 years agoMark the Crossgen2 regression test GitHub_49982 ilasm-incompatible (#51005)
Tomáš Rylek [Sat, 10 Apr 2021 00:08:48 +0000 (17:08 -0700)]
Mark the Crossgen2 regression test GitHub_49982 ilasm-incompatible (#51005)

3 years agoRemoved must-init requirement for GS Cookies (#50702)
SingleAccretion [Fri, 9 Apr 2021 23:20:53 +0000 (02:20 +0300)]
Removed must-init requirement for GS Cookies (#50702)

The cookie is always initialized in the prolog, where no user code is allowed.
There should be no GC concerns either as the prolog is not interruptible.

3 years agoJIT: Fix loop unscaling computations (#50807)
Andy Ayers [Fri, 9 Apr 2021 23:19:08 +0000 (16:19 -0700)]
JIT: Fix loop unscaling computations (#50807)

Changes made in #50633 were simply wrong, and lead to division by
infinite values.

Fixes #50743.

3 years ago[mono][aot] Handle out of range indexes in the generated get_method () functions...
Zoltan Varga [Fri, 9 Apr 2021 21:36:05 +0000 (17:36 -0400)]
[mono][aot] Handle out of range indexes in the generated get_method () functions, they (#50217)

can happen since mini-llvm.c and aot-compiler.c can compute different table sizes.

Fixes https://github.com/dotnet/runtime/issues/50202.

3 years agoImplement Enumerable.*By methods (DistinctBy, ExceptBy, IntersectBy, UnionBy, MinBy...
Eirik Tsarpalis [Fri, 9 Apr 2021 21:32:27 +0000 (22:32 +0100)]
Implement Enumerable.*By methods (DistinctBy, ExceptBy, IntersectBy, UnionBy, MinBy, MaxBy) (#50335)

* Implement Enumerable.*By operators

* apply feedback

* Update src/libraries/System.Linq/src/System/Linq/Distinct.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoMake TranscodingStream resilient against partial reads (#50886)
Levi Broderick [Fri, 9 Apr 2021 21:04:54 +0000 (14:04 -0700)]
Make TranscodingStream resilient against partial reads (#50886)

3 years agoAdd MetadataUpdateHandlerAttribute (#50954)
Stephen Toub [Fri, 9 Apr 2021 20:28:57 +0000 (16:28 -0400)]
Add MetadataUpdateHandlerAttribute (#50954)

* Add MetadataUpdateHandlerAttribute

And at least the beginning of reflection cache clearing support.

* Address PR feedback

* Update src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoJIT: Catch "cns".Length also in Morph (#50318)
Egor Bogatov [Fri, 9 Apr 2021 18:47:30 +0000 (21:47 +0300)]
JIT: Catch "cns".Length also in Morph (#50318)

Co-authored-by: Andy Ayers <andya@microsoft.com>
3 years agoMake sure separated_poh_p and use_large_pages_p works together (#50665)
Andrew Au [Fri, 9 Apr 2021 17:43:21 +0000 (10:43 -0700)]
Make sure separated_poh_p and use_large_pages_p works together (#50665)

3 years agobasic certificate handling for quic (#50613)
Tomas Weinfurt [Fri, 9 Apr 2021 16:29:05 +0000 (09:29 -0700)]
basic certificate handling for quic (#50613)

* basic certificate handling for quic

* fix linux

* fix macOS

* feedback from review

* feedback from review

3 years agoSwitch to VS preview pool for public builds (#50993)
Alexander Köplinger [Fri, 9 Apr 2021 14:13:24 +0000 (16:13 +0200)]
Switch to VS preview pool for public builds (#50993)

* Switch to VS preview pool for public builds

Should help mitigate https://github.com/dotnet/runtime/issues/50746

* Run init-vs-env.cmd for Browser wasm Windows build

The BuildPool.Windows.10.Amd64.VS2019.Pre.Open queue doesn't have ninja installed outside of VS so it's only available in PATH if you run the init-vs-env.cmd script.

3 years ago[wasm] Copy icu libs to runtime pack (#50991)
Radek Doulik [Fri, 9 Apr 2021 13:02:54 +0000 (15:02 +0200)]
[wasm] Copy icu libs to runtime pack (#50991)

On Windows we were missing native icu libs in the runtime pack.

3 years agoCleanup PlatformSpecific/SkipOnMono attributes that skip a platform (#50907)
Alexander Köplinger [Fri, 9 Apr 2021 11:20:18 +0000 (13:20 +0200)]
Cleanup PlatformSpecific/SkipOnMono attributes that skip a platform (#50907)

We have a bunch of test assemblies that don't make sense on some platforms, e.g. Browser.
Right now we're skipping them via `[SkipOnMono("reason", TestPlatforms.Browser)]` but there's nothing that inherently ties this to Mono other than the current implementation.

The more generic `SkipOnPlatform` attribute can be used instead.
We can also use it in places where we do `[PlatformSpecific(~TestPlatforms....)]` to avoid the double inversion.

3 years agoConsider failing tests a failure (#50898)
Michal Strehovský [Fri, 9 Apr 2021 08:58:05 +0000 (10:58 +0200)]
Consider failing tests a failure (#50898)

When running `build libs.tests -test` locally, I see the build succeeding even though there's failing tests. This seems to be caused by Helix specific logic in the runner template. It should not apply when we're not running in Helix.

3 years agoFix GC hole on arm32 (#50759)
Bruce Forstall [Fri, 9 Apr 2021 01:48:59 +0000 (18:48 -0700)]
Fix GC hole on arm32 (#50759)

On arm32 only, in cases where we have STOREIND(GT_LCL_VAR_ADDR) of
a GC var, the JIT was generating (e.g.):
```
add     r1, sp, 48   // [V27 tmp23]
str     r0, [r1]
```
If this was a local variable birth, codegen would correctly process the lifetime. However,
we would have created an instrDesc that knows nothing about the local var, so can't emit
any GC transitions during emission.

It turns out this is also sub-optimal code; we don't need to create a byref of the
address of a local when we can encode the address directly in an addressing mode, as:
```
str     r0, [sp+48]   // [V27 tmp23]
```

There was already code on arm64 to handle this case, by making the LCL_VAR_ADDR contained
and using the emitIns_S_R / emitIns_R_S functions, which create instrDescs with the necessary
local tracking info.

I added an assert, on both arm32 and arm64, that non-contained local var address nodes must
refer to untracked locals. Otherwise, we could potentially create addresses where we don't
properly track the GC info.

There are quite a few diffs, avoiding creating the local var address. There are several cases
I noted in the Microsoft.CodeAnalysis assemblies of bad GC info now fixed (this is where the
initial failure came from, that the Runtime_45557 test was derived from).

From libraries crossgen:

```

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 255542
Total bytes of diff: 251924
Total bytes of delta: -3618 (-1.42% of base)
    diff is an improvement.
```
<details>

<summary>Detail diffs</summary>

```

Top file improvements (bytes):
         -18 : 133274.dasm (-0.95% of base)
         -16 : 136993.dasm (-1.44% of base)
         -14 : 127453.dasm (-1.35% of base)
         -12 : 126915.dasm (-1.15% of base)
         -12 : 63852.dasm (-1.71% of base)
         -12 : 137357.dasm (-3.59% of base)
         -12 : 7927.dasm (-2.29% of base)
         -12 : 39850.dasm (-1.11% of base)
         -10 : 132884.dasm (-2.11% of base)
         -10 : 10262.dasm (-0.95% of base)
         -10 : 131112.dasm (-7.35% of base)
         -10 : 74924.dasm (-4.50% of base)
          -8 : 10344.dasm (-5.48% of base)
          -8 : 10435.dasm (-6.67% of base)
          -8 : 56301.dasm (-1.08% of base)
          -8 : 56683.dasm (-0.31% of base)
          -8 : 56686.dasm (-0.49% of base)
          -8 : 10341.dasm (-5.48% of base)
          -8 : 10346.dasm (-5.06% of base)
          -8 : 126900.dasm (-0.43% of base)

1107 total files with Code Size differences (1107 improved, 0 regressed), 0 unchanged.

Top method improvements (bytes):
         -18 (-0.95% of base) : 133274.dasm - Microsoft.CodeAnalysis.CSharp.Binder:CreateUserDefinedConversion(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode,Microsoft.CodeAnalysis.CSharp.BoundExpression,Microsoft.CodeAnalysis.CSharp.Conversion,bool,Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol,Microsoft.CodeAnalysis.DiagnosticBag):Microsoft.CodeAnalysis.CSharp.BoundExpression:this
         -16 (-1.44% of base) : 136993.dasm - Enumerator:MoveNext():bool:this
         -14 (-1.35% of base) : 127453.dasm - Microsoft.CodeAnalysis.CSharp.OverloadResolution:IsApplicable(Microsoft.CodeAnalysis.CSharp.Symbol,EffectiveParameters,Microsoft.CodeAnalysis.CSharp.AnalyzedArguments,System.Collections.Immutable.ImmutableArray`1[Int32],bool,bool,bool,byref):Microsoft.CodeAnalysis.CSharp.MemberAnalysisResult:this
         -12 (-1.15% of base) : 126915.dasm - Microsoft.CodeAnalysis.CSharp.OverloadResolution:IsMemberApplicableInExpandedForm(System.__Canon,System.__Canon,Microsoft.CodeAnalysis.ArrayBuilder`1[[Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.CSharp.AnalyzedArguments,bool,byref):Microsoft.CodeAnalysis.CSharp.MemberResolutionResult`1[__Canon]:this
         -12 (-1.71% of base) : 63852.dasm - System.Security.Cryptography.RSAKeyFormatHelper:FromPkcs1PrivateKey(System.ReadOnlyMemory`1[Byte],byref,byref)
         -12 (-3.59% of base) : 137357.dasm - System.Reflection.Metadata.Ecma335.ControlFlowBuilder:AddExceptionRegion(ushort,System.Reflection.Metadata.Ecma335.LabelHandle,System.Reflection.Metadata.Ecma335.LabelHandle,System.Reflection.Metadata.Ecma335.LabelHandle,System.Reflection.Metadata.Ecma335.LabelHandle,System.Reflection.Metadata.Ecma335.LabelHandle,System.Reflection.Metadata.EntityHandle):this
         -12 (-2.29% of base) : 7927.dasm - Microsoft.CodeAnalysis.Emit.AddedOrChangedMethodInfo:MapTypes(Microsoft.CodeAnalysis.Emit.SymbolMatcher):Microsoft.CodeAnalysis.Emit.AddedOrChangedMethodInfo:this
         -12 (-1.11% of base) : 39850.dasm - Internal.Cryptography.Pal.OpenSslX509CertificateReader:CopyWithPrivateKey(System.Security.Cryptography.RSA):Internal.Cryptography.ICertificatePal:this
         -10 (-2.11% of base) : 132884.dasm - Microsoft.CodeAnalysis.CSharp.OverloadResolution:IsConstructorApplicableInExpandedForm(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol,Microsoft.CodeAnalysis.CSharp.AnalyzedArguments,byref):Microsoft.CodeAnalysis.CSharp.MemberAnalysisResult:this
         -10 (-0.95% of base) : 10262.dasm - Microsoft.CodeAnalysis.Emit.DeltaMetadataWriter:SerializeLocalVariablesSignature(Microsoft.Cci.IMethodBody):int:this
         -10 (-7.35% of base) : 131112.dasm - Microsoft.CodeAnalysis.CSharp.MemberAnalysisResult:BadArgumentConversions(System.Collections.Immutable.ImmutableArray`1[Int32],System.Collections.Immutable.ImmutableArray`1[Int32],System.Collections.Immutable.ImmutableArray`1[Conversion]):Microsoft.CodeAnalysis.CSharp.MemberAnalysisResult
         -10 (-4.50% of base) : 74924.dasm - System.MemoryExtensions:AsMemory(System.__Canon[],System.Range):System.Memory`1[__Canon]
          -8 (-5.48% of base) : 10344.dasm - Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers:GetAnalyzerSyntaxDiagnosticsCoreAsync(Microsoft.CodeAnalysis.SyntaxTree,System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostic, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
          -8 (-6.67% of base) : 10435.dasm - Microsoft.CodeAnalysis.Diagnostics.AnalysisState:OnCompilationEventsGeneratedAsync(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostics.CompilationEvent, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver,System.Threading.CancellationToken):System.Threading.Tasks.Task:this
          -8 (-1.08% of base) : 56301.dasm - Microsoft.CodeAnalysis.VisualBasic.Symbols.MethodSignatureComparer:HaveSameParameterTypes(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.VisualBasic.Symbols.ParameterSymbol, Microsoft.CodeAnalysis.VisualBasic, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.VisualBasic.Symbols.TypeSubstitution,System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.VisualBasic.Symbols.ParameterSymbol, Microsoft.CodeAnalysis.VisualBasic, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.VisualBasic.Symbols.TypeSubstitution,bool,bool):bool
          -8 (-0.31% of base) : 56683.dasm - Microsoft.CodeAnalysis.VisualBasic.Symbols.ConstraintsHelper:ReportIndirectConstraintConflicts(Microsoft.CodeAnalysis.VisualBasic.Symbols.SourceTypeParameterSymbol,Microsoft.CodeAnalysis.ArrayBuilder`1[TypeParameterDiagnosticInfo],byref)
          -8 (-0.49% of base) : 56686.dasm - Microsoft.CodeAnalysis.VisualBasic.Symbols.MethodSignatureComparer:DetailedParameterCompare(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.VisualBasic.Symbols.ParameterSymbol, Microsoft.CodeAnalysis.VisualBasic, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],byref,System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.VisualBasic.Symbols.ParameterSymbol, Microsoft.CodeAnalysis.VisualBasic, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],byref,int,int):int
          -8 (-5.48% of base) : 10341.dasm - Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers:GetAnalyzerCompilationDiagnosticsCoreAsync(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostic, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
          -8 (-5.06% of base) : 10346.dasm - Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers:GetAnalyzerSemanticDiagnosticsCoreAsync(Microsoft.CodeAnalysis.SemanticModel,System.Nullable`1[TextSpan],System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostic, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
          -8 (-0.43% of base) : 126900.dasm - Microsoft.CodeAnalysis.CSharp.OverloadResolutionResult`1[__Canon][System.__Canon]:ReportDiagnostics(Microsoft.CodeAnalysis.CSharp.Binder,Microsoft.CodeAnalysis.Location,Microsoft.CodeAnalysis.DiagnosticBag,System.String,Microsoft.CodeAnalysis.CSharp.BoundExpression,Microsoft.CodeAnalysis.CSharp.AnalyzedArguments,System.Collections.Immutable.ImmutableArray`1[__Canon],Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol,Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol,Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode,bool):this

Top method improvements (percentages):
          -6 (-13.64% of base) : 135707.dasm - System.Reflection.Metadata.BlobBuilder:WriteBytes(System.Collections.Immutable.ImmutableArray`1[Byte],int,int):this
          -4 (-13.33% of base) : 17244.dasm - System.Collections.Immutable.ImmutableArray`1[__Canon][System.__Canon]:op_Equality(System.Nullable`1[ImmutableArray`1],System.Nullable`1[ImmutableArray`1]):bool
          -4 (-13.33% of base) : 17245.dasm - System.Collections.Immutable.ImmutableArray`1[__Canon][System.__Canon]:op_Inequality(System.Nullable`1[ImmutableArray`1],System.Nullable`1[ImmutableArray`1]):bool
          -2 (-10.00% of base) : 138130.dasm - System.Reflection.Internal.ImmutableByteArrayInterop:DangerousGetUnderlyingArray(System.Collections.Immutable.ImmutableArray`1[Byte]):System.Byte[]
          -4 (-8.33% of base) : 75404.dasm - System.Range:Equals(System.Range):bool:this
         -10 (-7.35% of base) : 131112.dasm - Microsoft.CodeAnalysis.CSharp.MemberAnalysisResult:BadArgumentConversions(System.Collections.Immutable.ImmutableArray`1[Int32],System.Collections.Immutable.ImmutableArray`1[Int32],System.Collections.Immutable.ImmutableArray`1[Conversion]):Microsoft.CodeAnalysis.CSharp.MemberAnalysisResult
          -8 (-6.67% of base) : 10435.dasm - Microsoft.CodeAnalysis.Diagnostics.AnalysisState:OnCompilationEventsGeneratedAsync(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostics.CompilationEvent, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver,System.Threading.CancellationToken):System.Threading.Tasks.Task:this
          -8 (-5.80% of base) : 130961.dasm - Microsoft.CodeAnalysis.CSharp.MemberAnalysisResult:NormalForm(System.Collections.Immutable.ImmutableArray`1[Int32],System.Collections.Immutable.ImmutableArray`1[Conversion],bool):Microsoft.CodeAnalysis.CSharp.MemberAnalysisResult
          -8 (-5.56% of base) : 10340.dasm - Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers:GetAnalyzerCompilationDiagnosticsAsync(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostic, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
          -8 (-5.48% of base) : 10344.dasm - Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers:GetAnalyzerSyntaxDiagnosticsCoreAsync(Microsoft.CodeAnalysis.SyntaxTree,System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostic, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
          -8 (-5.48% of base) : 10341.dasm - Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers:GetAnalyzerCompilationDiagnosticsCoreAsync(System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],System.Threading.CancellationToken):System.Threading.Tasks.Task`1[[System.Collections.Immutable.ImmutableArray`1[[Microsoft.CodeAnalysis.Diagnostic, Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this
          -6 (-5.45% of base) : 166017.dasm - Newtonsoft.Json.Bson.BsonDataReader:DoReadAsDecimalAsync(System.Threading.CancellationToken):System.Threading.Tasks.Task`1[Nullable`1]:this
          -6 (-5.45% of base) : 166019.dasm - Newtonsoft.Json.Bson.BsonDataReader:DoReadAsDoubleAsync(System.Threading.CancellationToken):System.Threading.Tasks.Task`1[Nullable`1]:this
          -6 (-5.45% of base) : 166021.dasm - Newtonsoft.Json.Bson.BsonDataReader:DoReadAsInt32Async(System.Threading.CancellationToken):System.Threading.Tasks.Task`1[Nullable`1]:this
          -6 (-5.45% of base) : 166024.dasm - Newtonsoft.Json.Bson.BsonDataReader:ReaderReadAndAssertAsync(System.Threading.CancellationToken):System.Threading.Tasks.Task:this
          -6 (-5.45% of base) : 166067.dasm - Newtonsoft.Json.Bson.BsonDataWriter:CompleteAndCloseOutputAsync(System.Threading.CancellationToken):System.Threading.Tasks.Task:this
          -6 (-5.45% of base) : 93077.dasm - Newtonsoft.Json.JsonTextReader:ParseConstructorAsync(System.Threading.CancellationToken):System.Threading.Tasks.Task:this
          -6 (-5.45% of base) : 93084.dasm - Newtonsoft.Json.JsonTextReader:ReadNumberIntoBufferAsync(System.Threading.CancellationToken):System.Threading.Tasks.Task:this
          -6 (-5.45% of base) : 93085.dasm - Newtonsoft.Json.JsonTextReader:ParseUnquotedPropertyAsync(System.Threading.CancellationToken):System.Threading.Tasks.Task:this
          -6 (-5.45% of base) : 93086.dasm - Newtonsoft.Json.JsonTextReader:ReadNullCharAsync(System.Threading.CancellationToken):System.Threading.Tasks.Task`1[Boolean]:this

1107 total methods with Code Size differences (1107 improved, 0 regressed), 0 unchanged.

```

</details>

--------------------------------------------------------------------------------

Fixes #46023

3 years agoSwitch to ProjectExclusions for assembly-level ActiveIssue tests on browser (#50891)
Elinor Fung [Fri, 9 Apr 2021 01:37:21 +0000 (18:37 -0700)]
Switch to ProjectExclusions for assembly-level ActiveIssue tests on browser (#50891)

3 years agoAvoid exceptions from FileVersionInfo.TryLoadManagedAssemblyMetadata on Unix (#50237)
Stephen Toub [Fri, 9 Apr 2021 01:34:50 +0000 (21:34 -0400)]
Avoid exceptions from FileVersionInfo.TryLoadManagedAssemblyMetadata on Unix (#50237)

3 years agoensure that sync Connect calls ShouldRetrySyncOperation (#50788)
Geoff Kizer [Fri, 9 Apr 2021 01:34:23 +0000 (18:34 -0700)]
ensure that sync Connect calls ShouldRetrySyncOperation (#50788)

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoFix superpmi.py private store filtering (#50863)
Bruce Forstall [Thu, 8 Apr 2021 21:58:45 +0000 (14:58 -0700)]
Fix superpmi.py private store filtering (#50863)

* Fix superpmi.py private store filtering

Given a private store root, we need to filter to just
JIT/EE version, target OS, and target architecture, as we do for
Azure storage.

Previously, all files in the private store would always be considered,
no matter those settings.

* Remove unnecessary `lower()`

3 years agoFixed broken link (#50964)
erhanatesoglu [Thu, 8 Apr 2021 21:56:01 +0000 (14:56 -0700)]
Fixed broken link (#50964)

The link to xunit on github has changed.

3 years agoAdd design document for Mobile runtimeconfig.json host configuration (#50744)
Fan Yang [Thu, 8 Apr 2021 19:19:20 +0000 (15:19 -0400)]
Add design document for Mobile runtimeconfig.json host configuration (#50744)

* Add design document for Mobile runtimeconfig.json host configuration

* Remove tailing space

* Address review feedbacks

* Update docs/design/mono/mobile-runtimeconfig-json.md

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Add the missing word

* Update docs/design/mono/mobile-runtimeconfig-json.md

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Remove more tailing spaces

* Update docs/design/mono/mobile-runtimeconfig-json.md

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update docs/design/mono/mobile-runtimeconfig-json.md

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update docs/design/mono/mobile-runtimeconfig-json.md

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update docs/design/mono/mobile-runtimeconfig-json.md

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update docs/design/mono/mobile-runtimeconfig-json.md

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update docs/design/mono/mobile-runtimeconfig-json.md

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update docs/design/mono/mobile-runtimeconfig-json.md

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Address more review feedbacks

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
3 years ago[AndroidCrypto] Basic SSL stream implementation (#50519)
Elinor Fung [Thu, 8 Apr 2021 17:20:15 +0000 (10:20 -0700)]
[AndroidCrypto] Basic SSL stream implementation (#50519)

3 years ago[main] Update dependencies from dotnet/arcade (#50901)
dotnet-maestro[bot] [Thu, 8 Apr 2021 17:00:00 +0000 (17:00 +0000)]
[main] Update dependencies from dotnet/arcade (#50901)

[main] Update dependencies from dotnet/arcade

 - revert changes to publish-using-darc.ps1

https://github.com/dotnet/arcade/issues/6987

3 years agoMake some region parameters configurable (#50603)
Andrew Au [Thu, 8 Apr 2021 16:49:13 +0000 (09:49 -0700)]
Make some region parameters configurable (#50603)

3 years agoSet LC_ALL=C before running ping process in Ping.Send() (#50696)
smdn [Thu, 8 Apr 2021 15:39:59 +0000 (00:39 +0900)]
Set LC_ALL=C before running ping process in Ping.Send() (#50696)

* Add tests for ping command with locale environment variables.

* Set LC_ALL=C before running ping process.

ping command output is affected by locale environment variables.
This will cause an exception in ParsePingUtilityOutput().
Set LC_ALL=C to get the same output regardless of the environment variables.

Fix #50363.

3 years agoDisposing scopes more than once should work (#50852)
David Fowler [Thu, 8 Apr 2021 15:16:53 +0000 (08:16 -0700)]
Disposing scopes more than once should work (#50852)

- Recently introduced a regression where disposing DI scopes multiple times throws.

3 years agoFix target OS case-sensitivity (#50732)
Maxim Lipnin [Thu, 8 Apr 2021 14:11:07 +0000 (17:11 +0300)]
Fix target OS case-sensitivity (#50732)

3 years agocruntime/*printf*: free temporary string buffers also on failure (#50469)
Tom Deseyn [Thu, 8 Apr 2021 13:45:08 +0000 (15:45 +0200)]
cruntime/*printf*: free temporary string buffers also on failure (#50469)

3 years ago[wasm] Add targets to run samples (#50244)
Radek Doulik [Thu, 8 Apr 2021 12:17:06 +0000 (14:17 +0200)]
[wasm] Add targets to run samples (#50244)

Add `RunSample` targets to wasm samples projects.

Mention how to run the samples in README

3 years ago[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharne...
dotnet-maestro[bot] [Thu, 8 Apr 2021 11:26:18 +0000 (11:26 +0000)]
[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharness dotnet/llvm-project (#50733)

[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharness dotnet/llvm-project

 - Revert changes to publish-using-darc.ps1

https://github.com/dotnet/arcade/issues/6987

 - revert changes to publish-using-darc.ps1

https://github.com/dotnet/arcade/issues/6987

3 years agoMake ModuleTests.ResolveField/Method actually test something (#50280)
Michal Strehovský [Thu, 8 Apr 2021 10:44:53 +0000 (12:44 +0200)]
Make ModuleTests.ResolveField/Method actually test something (#50280)

* See if ModuleTests.ResolveField does anything

* Yup, it wasn't testing anything

* Update ModuleTests.cs

3 years agoDisable Net5CompatFileStream by default (#50166)
Adam Sitnik [Thu, 8 Apr 2021 10:40:17 +0000 (12:40 +0200)]
Disable Net5CompatFileStream by default (#50166)

3 years agoResolve ILLink warnings on System.Private.DataContractSerialization Part 1; Json...
Jose Perez Rodriguez [Thu, 8 Apr 2021 07:19:27 +0000 (00:19 -0700)]
Resolve ILLink warnings on System.Private.DataContractSerialization Part 1; Json) (#50619)

* Resolve ILLink warnings on System.Private.DataContractSerialization (Part 1; Json)

* Marking other two constructors as Unsafe

* Refactor GetInvokeMethod into a single suppressed call

3 years agoFix handling of not found exported types (#50845)
Michal Strehovský [Thu, 8 Apr 2021 07:13:27 +0000 (09:13 +0200)]
Fix handling of not found exported types (#50845)

This was missed in #50437.

Wonder if we should have just introduced a new overload of GetType that returns `object`. This "return resolution failure that we then need to not forget to check" looks like a potential bug farm.

```csharp
public MetadataType GetType(string nameSpace, string name, bool throwIfNotFound = true)
{
    /* the obvious implementation that calls the virtual method */
}

public abstract object GetType(string nameSpace, string name, NotFoundBehavior notFoundBehavior)
```

3 years agoFix contained LCL_VAR_ADDR in RMW. (#50669)
Sergey Andreenko [Thu, 8 Apr 2021 04:41:37 +0000 (21:41 -0700)]
Fix contained LCL_VAR_ADDR in RMW. (#50669)

* Add repro test.

* Fix the bug.

* change class name in the test

3 years agoUpdate build-runtime.cmd help documentation (#50829)
Bruce Forstall [Wed, 7 Apr 2021 22:17:31 +0000 (15:17 -0700)]
Update build-runtime.cmd help documentation (#50829)

* Update build-runtime.cmd help documentation

Add documentation for `-component`.

Remove unused `-priority` processing: that was for when this build
script could pass through options to the tests build script.

* Update src/coreclr/build-runtime.cmd

Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
3 years agoClarify instructions for building individual test with native dependency (#50869)
Elinor Fung [Wed, 7 Apr 2021 20:59:03 +0000 (13:59 -0700)]
Clarify instructions for building individual test with native dependency (#50869)

3 years agoDelete infra changes (#50789)
Prashanth Govindarajan [Wed, 7 Apr 2021 20:31:24 +0000 (13:31 -0700)]
Delete infra changes (#50789)

* Delete infra changes from https://github.com/dotnet/runtime/pull/48527

* sq

3 years agoFix JIT rolling build for new build-runtime script arguments (#50876)
Bruce Forstall [Wed, 7 Apr 2021 20:26:35 +0000 (13:26 -0700)]
Fix JIT rolling build for new build-runtime script arguments (#50876)

Adjust for https://github.com/dotnet/runtime/pull/49906

3 years ago[wasm] Set __DistroRid on Windows to browser-wasm (#50842)
Radek Doulik [Wed, 7 Apr 2021 20:04:53 +0000 (22:04 +0200)]
[wasm] Set __DistroRid on Windows to browser-wasm (#50842)

3 years ago[wasm] Fix order of include paths, to have the obj dir first (#50303)
Ankit Jain [Wed, 7 Apr 2021 17:51:38 +0000 (13:51 -0400)]
[wasm] Fix order of include paths, to have the obj dir first (#50303)

* [wasm] Fix order of include paths, to have the obj dir first

this regressed recently, and we started using `pinvoke-table.h`, and
`icall-table.h` from the runtime pack instead of from the obj dir.

* [wasm] Don't include pinvoke-table.h in the runtime pack.

`pinvoke-table.h` is generated when building the native files for wasm.
They are not required in the runtime pack, as any wasm app build needing
to do native relinking would be generating one of it's own.

* Fix the property name

3 years ago[wasm] Fix debug build of AOT cross compiler (#50418)
Radek Doulik [Wed, 7 Apr 2021 17:31:53 +0000 (19:31 +0200)]
[wasm] Fix debug build of AOT cross compiler (#50418)

For mono AOT cross compiler we use llvm libraries
from `runtime.win-x64.microsoft.netcore.runtime.mono.llvm.sdk` package.
These are built in Release configuration. On windows we get
linker errors when mixing them with obj files compiled with debug flags.

To avoid that, build the AOT cross compiler always as in Release
configuration.

Example of the errors:

    LLVMSupport.lib(Unicode.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in monosgen-2.0.lib(mini-llvm-cpp.cpp.obj)
    LLVMSupport.lib(Unicode.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in monosgen-2.0.lib(mini-llvm-cpp.cpp.obj)

3 years agoFix outdated comment (#50834)
Martin Costello [Wed, 7 Apr 2021 17:25:47 +0000 (18:25 +0100)]
Fix outdated comment (#50834)

Fix comments that refer to a method that is no longer in the same file.

3 years ago[wasm][tests] Add properties to allow passing args to xharness (#50678)
Ankit Jain [Wed, 7 Apr 2021 17:06:55 +0000 (13:06 -0400)]
[wasm][tests] Add properties to allow passing args to xharness (#50678)

* [wasm][tests] Add properties to allow passing args to xharness

New properties:
- `$(WasmXHarnessArgs)`
- `$(WasmXHarnessMonoArgs)`
- `$(WasmTestAppArgs)`

Xharness command line is built with these:

`dotnet xharness wasm test .. $(WasmXHarnessArgs) .. -- $(WasmXHarnessMonoArgs) .. --run .. $(WasmTestAppArgs)`

* [wasm][tests] extract wasm bits into tests.wasm.targets

* [wasm] set EMSDK_PATH for makefile run-tests- targets

* [wasm] Update target dependencies for wasm

* Don't overwrite RunScriptCommand, thus fixing wasm build tests

* Track property name changes

3 years agoVectorized common String.Split() paths (#38001)
Benjamin Bartels [Wed, 7 Apr 2021 16:35:42 +0000 (17:35 +0100)]
Vectorized common String.Split() paths (#38001)

* Vectorized String.Split()

* Fixed variable name

* Update src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs

Co-authored-by: Günther Foidl <gue@korporal.at>
* Update src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs

Co-authored-by: Günther Foidl <gue@korporal.at>
* Applied Review Feedback

* Update src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs

Co-authored-by: Günther Foidl <gue@korporal.at>
* Applied Review Feedback

* Built branchless version with help of @gfoidl

* Update src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs

Co-authored-by: Günther Foidl <gue@korporal.at>
* Removed nullable separator parameters

* Refactored MakeSeparatorList

* Fixed mistakenly removed comments

* Removed dependency on BMI2 PEXT instruction

* Fixed mistaken use of Vector<ushort>.Count

* Lowered string.Split() vectorization dependency from Avx2 to SSE41

* Added Sse.IsSupported check

* Updated IsSupported check to match highest used ISA

* Fixed possible cause for failing tests

Co-authored-by: Günther Foidl <gue@korporal.at>
3 years agoFix binplacing symbol files. (#50819)
Jeremy Koritzinsky [Wed, 7 Apr 2021 16:30:00 +0000 (09:30 -0700)]
Fix binplacing symbol files. (#50819)

3 years agoMove type check to after the null ref branch in out marshalling of blittable classes...
Jeremy Koritzinsky [Wed, 7 Apr 2021 16:29:20 +0000 (09:29 -0700)]
Move type check to after the null ref branch in out marshalling of blittable classes. (#50735)

3 years agoRemove extraneous CMake version requirement. (#50805)
Jeremy Koritzinsky [Wed, 7 Apr 2021 16:24:50 +0000 (09:24 -0700)]
Remove extraneous CMake version requirement. (#50805)

3 years ago[wasm] Remove unncessary condition for EMSDK (#50810)
Ankit Jain [Wed, 7 Apr 2021 15:33:28 +0000 (11:33 -0400)]
[wasm] Remove unncessary condition for EMSDK (#50810)

We check for `emsdk` is much more granular way now, and at the points
where it will actually be used. So, remove these stale early checks for
`emsdk`.

Fixes https://github.com/dotnet/runtime/issues/50801