JIT: recover types from helper calls and more by AndyAyersMS · Pull Request #20447 · dotnet/coreclr (original) (raw)

@briansull PTAL
cc @dotnet/jit-contrib

Per PMI: increases the rate of successful (virtual) call devirtualization from 0.182 to 0.195, and overall devirtualization from 0.156 to 0.166.

About 3000 more virtual call sites devirtualized (out of ~190000).

Jit-diffs (PMI, x64) shows:

Total bytes of diff: -6782 (-0.02% of base)
    diff is an improvement.

Top file regressions by size (bytes):
         251 : System.Net.Sockets.dasm (0.13% of base)
         110 : CommandLine.dasm (0.03% of base)
         109 : System.Security.Permissions.dasm (0.52% of base)
          40 : System.Drawing.Primitives.dasm (0.14% of base)
          16 : System.Private.Uri.dasm (0.02% of base)

Top file improvements by size (bytes):
       -2875 : System.Private.Xml.dasm (-0.08% of base)
       -1879 : System.Private.CoreLib.dasm (-0.05% of base)
        -430 : System.Linq.Expressions.dasm (-0.06% of base)
        -402 : System.Linq.Queryable.dasm (-0.20% of base)
        -328 : System.Private.DataContractSerialization.dasm (-0.04% of base)

54 total files with size differences (41 improved, 13 regressed), 75 unchanged.

Top method regressions by size (bytes):
         405 : System.Private.CoreLib.dasm - ICustomPropertyProviderProxy`2:GetInterface(byref,byref):int:this (5 methods)
         131 : System.Private.Xml.dasm - XsltCompileContext:GetExtentionMethod(ref,ref,ref,byref):ref:this
          91 : System.Private.CoreLib.dasm - CustomAttributeData:Init(ref):this (5 methods)
          62 : System.Private.CoreLib.dasm - ComActivator:GetClassFactoryForType(struct):ref
          55 : CommandLine.dasm - EnumerableExtensions:Memorize(ref):ref (5 methods)

Top method improvements by size (bytes):
        -283 : System.Private.Xml.dasm - XmlAnyConverter:ChangeType(ref,ref,ref):ref:this (2 methods)
        -230 : System.Private.Xml.dasm - XmlUntypedConverter:ChangeType(ref,ref,ref):ref:this (2 methods)
        -180 : System.Private.Xml.dasm - XmlUntypedConverter:ToString(ref,ref):ref:this
        -160 : System.Private.Xml.dasm - XmlNumeric10Converter:ChangeType(ref,ref,ref):ref:this (2 methods)
        -155 : System.Linq.Queryable.dasm - EnumerableQuery`1:System.Linq.IQueryProvider.CreateQuery(ref):ref:this (30 methods)

828 total methods with size differences (554 improved, 274 regressed), 191789 unchanged.

Size regressions are mostly from inlining methods with GUID arguments, where we subsequently fail to remove the struct copies.

Size improvements and devirtualizations largely come from the fact that many type operations return RuntimeType and that type is sealed.