Skip to content
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

JIT: reduce importer spilling for some stfld #51158

Merged
merged 1 commit into from
Apr 14, 2021

Conversation

AndyAyersMS
Copy link
Member

If we know which local is going to be updated, just spill that local.

If we know which local is going to be updated, just spill that local.
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 13, 2021
@AndyAyersMS AndyAyersMS marked this pull request as ready for review April 14, 2021 03:23
@AndyAyersMS
Copy link
Member Author

Inspired by this example

using System;
using System.Runtime.CompilerServices;

public struct StructField<T>
{   
    public T Value;
} 

class X
{
    static volatile int value;

    [MethodImpl(MethodImplOptions.NoInlining)]
    public void StructOfStructOfField1()
    {
        var x = new StructField<StructField<int>> { Value = new StructField<int> { Value = 123 } };
        value = x.Value.Value;
    }
}

Old codegen was:

G_M12726_IG01:
       push     rax
       xor      eax, eax
       mov      qword ptr [rsp], rax
						;; bbWeight=1    PerfScore 2.25
G_M12726_IG02:
       lea      rax, bword ptr [rsp]
       mov      dword ptr [rax], 123
       mov      eax, dword ptr [rsp]
       mov      dword ptr [reloc classVar[0xd1ffab1e]], eax
						;; bbWeight=1    PerfScore 3.50
G_M12726_IG03:
       add      rsp, 8
       ret      

New codegen is

G_M12726_IG01:
						;; bbWeight=1    PerfScore 0.00
G_M12726_IG02:
       mov      dword ptr [reloc classVar[0xd1ffab1e]], 123
						;; bbWeight=1    PerfScore 1.00
G_M12726_IG03:
       ret      

@sandreeko PTAL
cc @dotnet/jit-contrib

ASP.NET

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 1567
Total bytes of diff: 1472
Total bytes of delta: -95 (-6.06% of base)
    diff is an improvement.
Detail diffs


Top file improvements (bytes):
         -60 : 17749.dasm (-17.44% of base)
         -25 : 4138.dasm (-2.91% of base)
         -10 : 8632.dasm (-2.75% of base)

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

Top method improvements (bytes):
         -60 (-17.44% of base) : 17749.dasm - ILGenerator:AddFixup(Label,int,int):this
         -25 (-2.91% of base) : 4138.dasm - PortableThreadPool:.ctor():this
         -10 (-2.75% of base) : 8632.dasm - LoggerFactory:AddProviderRegistration(ILoggerProvider,bool):this

Top method improvements (percentages):
         -60 (-17.44% of base) : 17749.dasm - ILGenerator:AddFixup(Label,int,int):this
         -25 (-2.91% of base) : 4138.dasm - PortableThreadPool:.ctor():this
         -10 (-2.75% of base) : 8632.dasm - LoggerFactory:AddProviderRegistration(ILoggerProvider,bool):this

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


Benchmarks

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 2475
Total bytes of diff: 2456
Total bytes of delta: -19 (-0.77% of base)
    diff is an improvement.
Detail diffs


Top file regressions (bytes):
           4 : 19737.dasm (1.61% of base)
           4 : 19664.dasm (1.02% of base)

Top file improvements (bytes):
         -23 : 14898.dasm (-7.44% of base)
          -2 : 19004.dasm (-0.48% of base)
          -2 : 19703.dasm (-1.64% of base)

5 total files with Code Size differences (3 improved, 2 regressed), 4 unchanged.

Top method regressions (bytes):
           4 ( 1.61% of base) : 19737.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMethodDefinition(int,int,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle,int,System.Reflection.Metadata.ParameterHandle):System.Reflection.Metadata.MethodDefinitionHandle:this
           4 ( 1.02% of base) : 19664.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddAssemblyReference(System.Reflection.Metadata.StringHandle,System.Version,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle,int,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.AssemblyReferenceHandle:this

Top method improvements (bytes):
         -23 (-7.44% of base) : 14898.dasm - System.Formats.Cbor.Tests.ECDsaCosePublicKey:.ctor(System.String,System.String,System.String,System.String,System.String):this
          -2 (-0.48% of base) : 19004.dasm - Microsoft.CodeAnalysis.CodeGen.ILBuilder:ReconcileTrailingMarkers():this
          -2 (-1.64% of base) : 19703.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMemberReference(System.Reflection.Metadata.EntityHandle,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.MemberReferenceHandle:this

Top method regressions (percentages):
           4 ( 1.61% of base) : 19737.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMethodDefinition(int,int,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle,int,System.Reflection.Metadata.ParameterHandle):System.Reflection.Metadata.MethodDefinitionHandle:this
           4 ( 1.02% of base) : 19664.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddAssemblyReference(System.Reflection.Metadata.StringHandle,System.Version,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle,int,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.AssemblyReferenceHandle:this

Top method improvements (percentages):
         -23 (-7.44% of base) : 14898.dasm - System.Formats.Cbor.Tests.ECDsaCosePublicKey:.ctor(System.String,System.String,System.String,System.String,System.String):this
          -2 (-1.64% of base) : 19703.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMemberReference(System.Reflection.Metadata.EntityHandle,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.MemberReferenceHandle:this
          -2 (-0.48% of base) : 19004.dasm - Microsoft.CodeAnalysis.CodeGen.ILBuilder:ReconcileTrailingMarkers():this

5 total methods with Code Size differences (3 improved, 2 regressed), 4 unchanged.


Libraries Crossgen2 

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 30422
Total bytes of diff: 30200
Total bytes of delta: -222 (-0.73% of base)
    diff is an improvement.
Detail diffs


Top file regressions (bytes):
          52 : 199780.dasm (1.81% of base)
           2 : 7666.dasm (0.33% of base)

Top file improvements (bytes):
         -66 : 7675.dasm (-12.99% of base)
         -46 : 203525.dasm (-1.91% of base)
         -21 : 178986.dasm (-3.10% of base)
         -18 : 211455.dasm (-2.56% of base)
         -18 : 203489.dasm (-1.52% of base)
         -16 : 184817.dasm (-8.08% of base)
         -13 : 189448.dasm (-1.83% of base)
          -9 : 8237.dasm (-5.77% of base)
          -5 : 203688.dasm (-0.93% of base)
          -4 : 116467.dasm (-1.43% of base)
          -4 : 211570.dasm (-0.35% of base)
          -4 : 179180.dasm (-0.34% of base)
          -4 : 199765.dasm (-0.30% of base)
          -4 : 200314.dasm (-0.27% of base)
          -3 : 23021.dasm (-1.41% of base)
          -3 : 23001.dasm (-1.87% of base)
          -2 : 23003.dasm (-1.30% of base)
          -2 : 23023.dasm (-0.97% of base)
          -1 : 23011.dasm (-0.78% of base)
          -1 : 23024.dasm (-0.58% of base)

54 total files with Code Size differences (52 improved, 2 regressed), 10 unchanged.

Top method regressions (bytes):
          52 ( 1.81% of base) : 199780.dasm - System.Security.Cryptography.Pkcs.CmsSigner:Sign(System.ReadOnlyMemory`1[System.Byte],System.String,bool,byref):System.Security.Cryptography.Pkcs.Asn1.SignerInfoAsn:this
           2 ( 0.33% of base) : 7666.dasm - Microsoft.Cci.MetadataWriter:PopulateMethodTableRows(System.Int32[]):this

Top method improvements (bytes):
         -66 (-12.99% of base) : 7675.dasm - Microsoft.Cci.MetadataWriter:PopulateGenericParamConstraintTableRows():this
         -46 (-1.91% of base) : 203525.dasm - System.Security.Cryptography.X509Certificates.CertificateRequest:Create(System.Security.Cryptography.X509Certificates.X500DistinguishedName,System.Security.Cryptography.X509Certificates.X509SignatureGenerator,System.DateTimeOffset,System.DateTimeOffset,System.ReadOnlySpan`1[System.Byte]):System.Security.Cryptography.X509Certificates.X509Certificate2:this
         -21 (-3.10% of base) : 178986.dasm - System.Security.Cryptography.ECCng:ExportPrimeCurveParameters(byref,System.Byte[],bool)
         -18 (-2.56% of base) : 211455.dasm - System.Security.Cryptography.ECCng:ExportPrimeCurveParameters(byref,System.Byte[],bool)
         -18 (-1.52% of base) : 203489.dasm - System.Security.Cryptography.X509Certificates.RSAPssX509SignatureGenerator:GetSignatureAlgorithmIdentifier(System.Security.Cryptography.HashAlgorithmName):System.Byte[]:this
         -16 (-8.08% of base) : 184817.dasm - Internal.TypeSystem.UniversalCanonLayoutAlgorithm:ComputeStaticFieldLayout(Internal.TypeSystem.DefType,int):Internal.TypeSystem.ComputedStaticFieldLayout:this
         -13 (-1.83% of base) : 189448.dasm - System.Reflection.Metadata.Ecma335.MetadataAggregator:GetGenerationHandle(System.Reflection.Metadata.Handle,byref):System.Reflection.Metadata.Handle:this
          -9 (-5.77% of base) : 8237.dasm - Microsoft.CodeAnalysis.InternalUtilities.ConcurrentLruCache`2:UnsafeAddNodeToTop(Roslyn.Utilities.FileKey,System.__Canon):this
          -5 (-0.93% of base) : 203688.dasm - Internal.Cryptography.Pal.X509Pal:ComputeCapiSha1OfPublicKey(System.Security.Cryptography.X509Certificates.PublicKey):System.Byte[]:this
          -4 (-1.43% of base) : 116467.dasm - Utilities.Cache`2:Add(Microsoft.Diagnostics.Symbols.SymbolReader+PdbSignature,System.__Canon):this
          -4 (-0.35% of base) : 211570.dasm - System.Security.Cryptography.CngKey:ExportPkcs8KeyBlob(bool,Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle,System.ReadOnlySpan`1[System.Char],int,System.Span`1[System.Byte],byref,byref):bool
          -4 (-0.34% of base) : 179180.dasm - System.Security.Cryptography.CngKeyLite:ExportPkcs8KeyBlob(bool,Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle,System.ReadOnlySpan`1[System.Char],int,System.Span`1[System.Byte],byref,byref):bool
          -4 (-0.30% of base) : 199765.dasm - System.Security.Cryptography.Pkcs.SignedCms:ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner,bool):this
          -4 (-0.27% of base) : 200314.dasm - Internal.Cryptography.Pal.AnyOS.ManagedPkcsPal:Encrypt(System.Security.Cryptography.Pkcs.CmsRecipientCollection,System.Security.Cryptography.Pkcs.ContentInfo,System.Security.Cryptography.Pkcs.AlgorithmIdentifier,System.Security.Cryptography.X509Certificates.X509Certificate2Collection,System.Security.Cryptography.CryptographicAttributeObjectCollection,System.Byte[],System.Byte[],System.Byte[]):System.Byte[]:this
          -3 (-1.41% of base) : 23021.dasm - <>c__DisplayClass0_20:<GetPropertyGetter>b__20(System.Diagnostics.Tracing.PropertyValue):System.Diagnostics.Tracing.PropertyValue:this
          -3 (-1.87% of base) : 23001.dasm - <>c:<GetFactory>b__25_18(System.Object):System.Diagnostics.Tracing.PropertyValue:this
          -2 (-1.30% of base) : 23003.dasm - <>c:<GetFactory>b__25_16(System.Object):System.Diagnostics.Tracing.PropertyValue:this
          -2 (-0.97% of base) : 23023.dasm - <>c__DisplayClass0_18:<GetPropertyGetter>b__18(System.Diagnostics.Tracing.PropertyValue):System.Diagnostics.Tracing.PropertyValue:this
          -1 (-0.78% of base) : 23011.dasm - <>c:<GetFactory>b__25_8(System.Object):System.Diagnostics.Tracing.PropertyValue:this
          -1 (-0.58% of base) : 23024.dasm - <>c__DisplayClass0_17:<GetPropertyGetter>b__17(System.Diagnostics.Tracing.PropertyValue):System.Diagnostics.Tracing.PropertyValue:this

Top method regressions (percentages):
          52 ( 1.81% of base) : 199780.dasm - System.Security.Cryptography.Pkcs.CmsSigner:Sign(System.ReadOnlyMemory`1[System.Byte],System.String,bool,byref):System.Security.Cryptography.Pkcs.Asn1.SignerInfoAsn:this
           2 ( 0.33% of base) : 7666.dasm - Microsoft.Cci.MetadataWriter:PopulateMethodTableRows(System.Int32[]):this

Top method improvements (percentages):
         -66 (-12.99% of base) : 7675.dasm - Microsoft.Cci.MetadataWriter:PopulateGenericParamConstraintTableRows():this
         -16 (-8.08% of base) : 184817.dasm - Internal.TypeSystem.UniversalCanonLayoutAlgorithm:ComputeStaticFieldLayout(Internal.TypeSystem.DefType,int):Internal.TypeSystem.ComputedStaticFieldLayout:this
          -9 (-5.77% of base) : 8237.dasm - Microsoft.CodeAnalysis.InternalUtilities.ConcurrentLruCache`2:UnsafeAddNodeToTop(Roslyn.Utilities.FileKey,System.__Canon):this
         -21 (-3.10% of base) : 178986.dasm - System.Security.Cryptography.ECCng:ExportPrimeCurveParameters(byref,System.Byte[],bool)
         -18 (-2.56% of base) : 211455.dasm - System.Security.Cryptography.ECCng:ExportPrimeCurveParameters(byref,System.Byte[],bool)
         -46 (-1.91% of base) : 203525.dasm - System.Security.Cryptography.X509Certificates.CertificateRequest:Create(System.Security.Cryptography.X509Certificates.X500DistinguishedName,System.Security.Cryptography.X509Certificates.X509SignatureGenerator,System.DateTimeOffset,System.DateTimeOffset,System.ReadOnlySpan`1[System.Byte]):System.Security.Cryptography.X509Certificates.X509Certificate2:this
          -3 (-1.87% of base) : 23001.dasm - <>c:<GetFactory>b__25_18(System.Object):System.Diagnostics.Tracing.PropertyValue:this
         -13 (-1.83% of base) : 189448.dasm - System.Reflection.Metadata.Ecma335.MetadataAggregator:GetGenerationHandle(System.Reflection.Metadata.Handle,byref):System.Reflection.Metadata.Handle:this
         -18 (-1.52% of base) : 203489.dasm - System.Security.Cryptography.X509Certificates.RSAPssX509SignatureGenerator:GetSignatureAlgorithmIdentifier(System.Security.Cryptography.HashAlgorithmName):System.Byte[]:this
          -4 (-1.43% of base) : 116467.dasm - Utilities.Cache`2:Add(Microsoft.Diagnostics.Symbols.SymbolReader+PdbSignature,System.__Canon):this
          -3 (-1.41% of base) : 23021.dasm - <>c__DisplayClass0_20:<GetPropertyGetter>b__20(System.Diagnostics.Tracing.PropertyValue):System.Diagnostics.Tracing.PropertyValue:this
          -2 (-1.30% of base) : 23003.dasm - <>c:<GetFactory>b__25_16(System.Object):System.Diagnostics.Tracing.PropertyValue:this
          -2 (-0.97% of base) : 23023.dasm - <>c__DisplayClass0_18:<GetPropertyGetter>b__18(System.Diagnostics.Tracing.PropertyValue):System.Diagnostics.Tracing.PropertyValue:this
          -5 (-0.93% of base) : 203688.dasm - Internal.Cryptography.Pal.X509Pal:ComputeCapiSha1OfPublicKey(System.Security.Cryptography.X509Certificates.PublicKey):System.Byte[]:this
          -1 (-0.83% of base) : 23005.dasm - <>c:<GetFactory>b__25_14(System.Object):System.Diagnostics.Tracing.PropertyValue:this
          -1 (-0.79% of base) : 23012.dasm - <>c:<GetFactory>b__25_7(System.Object):System.Diagnostics.Tracing.PropertyValue:this
          -1 (-0.79% of base) : 23013.dasm - <>c:<GetFactory>b__25_6(System.Object):System.Diagnostics.Tracing.PropertyValue:this
          -1 (-0.79% of base) : 23018.dasm - <>c:<GetFactory>b__25_1(System.Object):System.Diagnostics.Tracing.PropertyValue:this
          -1 (-0.79% of base) : 23019.dasm - <>c:<GetFactory>b__25_0(System.Object):System.Diagnostics.Tracing.PropertyValue:this
          -1 (-0.78% of base) : 23011.dasm - <>c:<GetFactory>b__25_8(System.Object):System.Diagnostics.Tracing.PropertyValue:this

54 total methods with Code Size differences (52 improved, 2 regressed), 10 unchanged.


Libraries PMI

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 37723
Total bytes of diff: 36542
Total bytes of delta: -1181 (-3.13% of base)
    diff is an improvement.
Detail diffs


Top file regressions (bytes):
          46 : 213155.dasm (1.28% of base)
          12 : 214422.dasm (1.08% of base)
          11 : 214447.dasm (3.75% of base)
           7 : 214446.dasm (2.88% of base)
           7 : 214448.dasm (3.15% of base)
           7 : 214450.dasm (1.24% of base)
           7 : 214449.dasm (2.34% of base)
           5 : 73249.dasm (0.81% of base)
           4 : 132476.dasm (3.88% of base)
           4 : 132489.dasm (1.67% of base)
           4 : 134452.dasm (3.77% of base)
           4 : 134453.dasm (1.61% of base)
           4 : 132475.dasm (3.81% of base)
           4 : 134465.dasm (1.94% of base)
           4 : 134493.dasm (1.02% of base)
           3 : 134469.dasm (3.90% of base)
           3 : 134497.dasm (3.90% of base)
           3 : 134504.dasm (4.05% of base)
           3 : 134514.dasm (4.05% of base)
           3 : 134461.dasm (3.95% of base)

Top file improvements (bytes):
       -1115 : 194357.dasm (-48.35% of base)
         -45 : 73393.dasm (-2.17% of base)
         -29 : 73301.dasm (-4.97% of base)
         -19 : 211533.dasm (-2.88% of base)
         -19 : 210976.dasm (-2.88% of base)
         -16 : 227639.dasm (-6.37% of base)
         -13 : 224916.dasm (-1.88% of base)
         -12 : 214241.dasm (-2.25% of base)
         -10 : 214442.dasm (-0.81% of base)
          -8 : 104574.dasm (-1.20% of base)
          -7 : 81669.dasm (-7.22% of base)
          -7 : 214402.dasm (-0.26% of base)
          -5 : 132487.dasm (-4.35% of base)
          -4 : 77252.dasm (-2.03% of base)
          -3 : 81809.dasm (-1.12% of base)
          -3 : 77668.dasm (-0.37% of base)
          -3 : 77233.dasm (-1.53% of base)
          -2 : 134456.dasm (-1.64% of base)
          -2 : 134508.dasm (-1.89% of base)
          -2 : 134454.dasm (-1.35% of base)

49 total files with Code Size differences (26 improved, 23 regressed), 15 unchanged.

Top method regressions (bytes):
          46 ( 1.28% of base) : 213155.dasm - System.Security.Cryptography.Pkcs.CmsSigner:Sign(System.ReadOnlyMemory`1[Byte],System.String,bool,byref):System.Security.Cryptography.Pkcs.Asn1.SignerInfoAsn:this
          12 ( 1.08% of base) : 214422.dasm - System.Security.Cryptography.X509Certificates.Pkcs10CertificationRequestInfo:ToPkcs10Request(System.Security.Cryptography.X509Certificates.X509SignatureGenerator,System.Security.Cryptography.HashAlgorithmName):System.Byte[]:this
          11 ( 3.75% of base) : 214447.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddDnsName(System.String):this
           7 ( 2.88% of base) : 214446.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddEmailAddress(System.String):this
           7 ( 3.15% of base) : 214448.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddUri(System.Uri):this
           7 ( 1.24% of base) : 214450.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddUserPrincipalName(System.String):this
           7 ( 2.34% of base) : 214449.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddIpAddress(System.Net.IPAddress):this
           5 ( 0.81% of base) : 73249.dasm - Microsoft.Cci.MetadataWriter:PopulateMethodTableRows(System.Int32[]):this
           4 ( 3.88% of base) : 132476.dasm - System.Reflection.PortableExecutable.DebugDirectoryBuilder:AddEntry(int,int,int):this
           4 ( 1.67% of base) : 132489.dasm - System.Reflection.PortableExecutable.DebugDirectoryBuilder:AddPdbChecksumEntry(System.String,System.Collections.Immutable.ImmutableArray`1[Byte]):this
           4 ( 3.77% of base) : 134452.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddFieldRelativeVirtualAddress(System.Reflection.Metadata.FieldDefinitionHandle,int):this
           4 ( 1.61% of base) : 134453.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMethodDefinition(int,int,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle,int,System.Reflection.Metadata.ParameterHandle):System.Reflection.Metadata.MethodDefinitionHandle:this
           4 ( 3.81% of base) : 132475.dasm - System.Reflection.PortableExecutable.DebugDirectoryBuilder:AddEntry(int,int,int,int):this
           4 ( 1.94% of base) : 134465.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddLocalScope(System.Reflection.Metadata.MethodDefinitionHandle,System.Reflection.Metadata.ImportScopeHandle,System.Reflection.Metadata.LocalVariableHandle,System.Reflection.Metadata.LocalConstantHandle,int,int):System.Reflection.Metadata.LocalScopeHandle:this
           4 ( 1.02% of base) : 134493.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddAssemblyReference(System.Reflection.Metadata.StringHandle,System.Version,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle,int,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.AssemblyReferenceHandle:this
           3 ( 3.90% of base) : 134469.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddStateMachineMethod(System.Reflection.Metadata.MethodDefinitionHandle,System.Reflection.Metadata.MethodDefinitionHandle):this
           3 ( 3.90% of base) : 134497.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddNestedType(System.Reflection.Metadata.TypeDefinitionHandle,System.Reflection.Metadata.TypeDefinitionHandle):this
           3 ( 4.05% of base) : 134504.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddEventMap(System.Reflection.Metadata.TypeDefinitionHandle,System.Reflection.Metadata.EventDefinitionHandle):this
           3 ( 4.05% of base) : 134514.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddFieldLayout(System.Reflection.Metadata.FieldDefinitionHandle,int):this
           3 ( 3.95% of base) : 134461.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddEncLogEntry(System.Reflection.Metadata.EntityHandle,int):this

Top method improvements (bytes):
       -1115 (-48.35% of base) : 194357.dasm - System.Net.WebSockets.WebSocketProtocolComponent:.cctor()
         -45 (-2.17% of base) : 73393.dasm - Microsoft.Cci.MetadataWriter:SerializeMethodDebugInfo(Microsoft.Cci.IMethodBody,int,int):this
         -29 (-4.97% of base) : 73301.dasm - Microsoft.Cci.MetadataWriter:PopulateGenericParamConstraintTableRows():this
         -19 (-2.88% of base) : 211533.dasm - System.Security.Cryptography.ECCng:ExportPrimeCurveParameters(byref,System.Byte[],bool)
         -19 (-2.88% of base) : 210976.dasm - System.Security.Cryptography.ECCng:ExportPrimeCurveParameters(byref,System.Byte[],bool)
         -16 (-6.37% of base) : 227639.dasm - Internal.TypeSystem.UniversalCanonLayoutAlgorithm:ComputeStaticFieldLayout(Internal.TypeSystem.DefType,int):Internal.TypeSystem.ComputedStaticFieldLayout:this
         -13 (-1.88% of base) : 224916.dasm - ILCompiler.DependencyAnalysis.ReadyToRun.AttributePresenceFilterNode:GetCustomAttributeEntries():System.Collections.Generic.List`1[CustomAttributeEntry]:this
         -12 (-2.25% of base) : 214241.dasm - Internal.Cryptography.Pal.X509Pal:ComputeCapiSha1OfPublicKey(System.Security.Cryptography.X509Certificates.PublicKey):System.Byte[]:this
         -10 (-0.81% of base) : 214442.dasm - System.Security.Cryptography.X509Certificates.RSAPssX509SignatureGenerator:GetSignatureAlgorithmIdentifier(System.Security.Cryptography.HashAlgorithmName):System.Byte[]:this
          -8 (-1.20% of base) : 104574.dasm - Newtonsoft.Json.Linq.JToken:get_Path():System.String:this
          -7 (-7.22% of base) : 81669.dasm - ComStreamWrapper:Stat(byref,int):this
          -7 (-0.26% of base) : 214402.dasm - System.Security.Cryptography.X509Certificates.CertificateRequest:Create(System.Security.Cryptography.X509Certificates.X500DistinguishedName,System.Security.Cryptography.X509Certificates.X509SignatureGenerator,System.DateTimeOffset,System.DateTimeOffset,System.ReadOnlySpan`1[Byte]):System.Security.Cryptography.X509Certificates.X509Certificate2:this
          -5 (-4.35% of base) : 132487.dasm - System.Reflection.PortableExecutable.DebugDirectoryBuilder:AddReproducibleEntry():this
          -4 (-2.03% of base) : 77252.dasm - Microsoft.CodeAnalysis.InternalUtilities.ConcurrentLruCache`2[Int16,Nullable`1][System.Int16,System.Nullable`1[System.Int32]]:UnsafeAddNodeToTop(short,System.Nullable`1[Int32]):this
          -3 (-1.12% of base) : 81809.dasm - Utilities.Cache`2[Vector`1,__Canon][System.Numerics.Vector`1[System.Single],System.__Canon]:Add(System.Numerics.Vector`1[Single],System.__Canon):this
          -3 (-0.37% of base) : 77668.dasm - Microsoft.CodeAnalysis.Emit.DeltaMetadataWriter:PopulateEncMapTableRows(System.Collections.Generic.List`1[EncMapRow],System.Collections.Immutable.ImmutableArray`1[Int32]):this
          -3 (-1.53% of base) : 77233.dasm - Microsoft.CodeAnalysis.InternalUtilities.ConcurrentLruCache`2[Byte,Nullable`1][System.Byte,System.Nullable`1[System.Int32]]:UnsafeAddNodeToTop(ubyte,System.Nullable`1[Int32]):this
          -2 (-1.64% of base) : 134456.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMemberReference(System.Reflection.Metadata.EntityHandle,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.MemberReferenceHandle:this
          -2 (-1.89% of base) : 134508.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMethodSpecification(System.Reflection.Metadata.EntityHandle,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.MethodSpecificationHandle:this
          -2 (-1.35% of base) : 134454.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMethodImport(System.Reflection.Metadata.MethodDefinitionHandle,short,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.ModuleReferenceHandle):this

Top method regressions (percentages):
           3 ( 4.05% of base) : 134504.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddEventMap(System.Reflection.Metadata.TypeDefinitionHandle,System.Reflection.Metadata.EventDefinitionHandle):this
           3 ( 4.05% of base) : 134514.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddFieldLayout(System.Reflection.Metadata.FieldDefinitionHandle,int):this
           3 ( 3.95% of base) : 134461.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddEncLogEntry(System.Reflection.Metadata.EntityHandle,int):this
           3 ( 3.90% of base) : 134469.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddStateMachineMethod(System.Reflection.Metadata.MethodDefinitionHandle,System.Reflection.Metadata.MethodDefinitionHandle):this
           3 ( 3.90% of base) : 134497.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddNestedType(System.Reflection.Metadata.TypeDefinitionHandle,System.Reflection.Metadata.TypeDefinitionHandle):this
           3 ( 3.90% of base) : 134502.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddPropertyMap(System.Reflection.Metadata.TypeDefinitionHandle,System.Reflection.Metadata.PropertyDefinitionHandle):this
           4 ( 3.88% of base) : 132476.dasm - System.Reflection.PortableExecutable.DebugDirectoryBuilder:AddEntry(int,int,int):this
           4 ( 3.81% of base) : 132475.dasm - System.Reflection.PortableExecutable.DebugDirectoryBuilder:AddEntry(int,int,int,int):this
           4 ( 3.77% of base) : 134452.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddFieldRelativeVirtualAddress(System.Reflection.Metadata.FieldDefinitionHandle,int):this
          11 ( 3.75% of base) : 214447.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddDnsName(System.String):this
           7 ( 3.15% of base) : 214448.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddUri(System.Uri):this
           7 ( 2.88% of base) : 214446.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddEmailAddress(System.String):this
           7 ( 2.34% of base) : 214449.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddIpAddress(System.Net.IPAddress):this
           4 ( 1.94% of base) : 134465.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddLocalScope(System.Reflection.Metadata.MethodDefinitionHandle,System.Reflection.Metadata.ImportScopeHandle,System.Reflection.Metadata.LocalVariableHandle,System.Reflection.Metadata.LocalConstantHandle,int,int):System.Reflection.Metadata.LocalScopeHandle:this
           4 ( 1.67% of base) : 132489.dasm - System.Reflection.PortableExecutable.DebugDirectoryBuilder:AddPdbChecksumEntry(System.String,System.Collections.Immutable.ImmutableArray`1[Byte]):this
           4 ( 1.61% of base) : 134453.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMethodDefinition(int,int,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle,int,System.Reflection.Metadata.ParameterHandle):System.Reflection.Metadata.MethodDefinitionHandle:this
          46 ( 1.28% of base) : 213155.dasm - System.Security.Cryptography.Pkcs.CmsSigner:Sign(System.ReadOnlyMemory`1[Byte],System.String,bool,byref):System.Security.Cryptography.Pkcs.Asn1.SignerInfoAsn:this
           7 ( 1.24% of base) : 214450.dasm - System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder:AddUserPrincipalName(System.String):this
          12 ( 1.08% of base) : 214422.dasm - System.Security.Cryptography.X509Certificates.Pkcs10CertificationRequestInfo:ToPkcs10Request(System.Security.Cryptography.X509Certificates.X509SignatureGenerator,System.Security.Cryptography.HashAlgorithmName):System.Byte[]:this
           4 ( 1.02% of base) : 134493.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddAssemblyReference(System.Reflection.Metadata.StringHandle,System.Version,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle,int,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.AssemblyReferenceHandle:this

Top method improvements (percentages):
       -1115 (-48.35% of base) : 194357.dasm - System.Net.WebSockets.WebSocketProtocolComponent:.cctor()
          -7 (-7.22% of base) : 81669.dasm - ComStreamWrapper:Stat(byref,int):this
         -16 (-6.37% of base) : 227639.dasm - Internal.TypeSystem.UniversalCanonLayoutAlgorithm:ComputeStaticFieldLayout(Internal.TypeSystem.DefType,int):Internal.TypeSystem.ComputedStaticFieldLayout:this
         -29 (-4.97% of base) : 73301.dasm - Microsoft.Cci.MetadataWriter:PopulateGenericParamConstraintTableRows():this
          -5 (-4.35% of base) : 132487.dasm - System.Reflection.PortableExecutable.DebugDirectoryBuilder:AddReproducibleEntry():this
         -19 (-2.88% of base) : 211533.dasm - System.Security.Cryptography.ECCng:ExportPrimeCurveParameters(byref,System.Byte[],bool)
         -19 (-2.88% of base) : 210976.dasm - System.Security.Cryptography.ECCng:ExportPrimeCurveParameters(byref,System.Byte[],bool)
         -12 (-2.25% of base) : 214241.dasm - Internal.Cryptography.Pal.X509Pal:ComputeCapiSha1OfPublicKey(System.Security.Cryptography.X509Certificates.PublicKey):System.Byte[]:this
         -45 (-2.17% of base) : 73393.dasm - Microsoft.Cci.MetadataWriter:SerializeMethodDebugInfo(Microsoft.Cci.IMethodBody,int,int):this
          -4 (-2.03% of base) : 77252.dasm - Microsoft.CodeAnalysis.InternalUtilities.ConcurrentLruCache`2[Int16,Nullable`1][System.Int16,System.Nullable`1[System.Int32]]:UnsafeAddNodeToTop(short,System.Nullable`1[Int32]):this
          -2 (-1.89% of base) : 134508.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMethodSpecification(System.Reflection.Metadata.EntityHandle,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.MethodSpecificationHandle:this
         -13 (-1.88% of base) : 224916.dasm - ILCompiler.DependencyAnalysis.ReadyToRun.AttributePresenceFilterNode:GetCustomAttributeEntries():System.Collections.Generic.List`1[CustomAttributeEntry]:this
          -2 (-1.64% of base) : 134456.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMemberReference(System.Reflection.Metadata.EntityHandle,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.MemberReferenceHandle:this
          -2 (-1.64% of base) : 134470.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddCustomDebugInformation(System.Reflection.Metadata.EntityHandle,System.Reflection.Metadata.GuidHandle,System.Reflection.Metadata.BlobHandle):System.Reflection.Metadata.CustomDebugInformationHandle:this
          -3 (-1.53% of base) : 77233.dasm - Microsoft.CodeAnalysis.InternalUtilities.ConcurrentLruCache`2[Byte,Nullable`1][System.Byte,System.Nullable`1[System.Int32]]:UnsafeAddNodeToTop(ubyte,System.Nullable`1[Int32]):this
          -2 (-1.35% of base) : 134454.dasm - System.Reflection.Metadata.Ecma335.MetadataBuilder:AddMethodImport(System.Reflection.Metadata.MethodDefinitionHandle,short,System.Reflection.Metadata.StringHandle,System.Reflection.Metadata.ModuleReferenceHandle):this
          -8 (-1.20% of base) : 104574.dasm - Newtonsoft.Json.Linq.JToken:get_Path():System.String:this
          -3 (-1.12% of base) : 81809.dasm - Utilities.Cache`2[Vector`1,__Canon][System.Numerics.Vector`1[System.Single],System.__Canon]:Add(System.Numerics.Vector`1[Single],System.__Canon):this
          -1 (-0.83% of base) : 77667.dasm - Microsoft.CodeAnalysis.Emit.DeltaMetadataWriter:PopulateEncLogTableRows(System.Collections.Generic.List`1[EncLogRow],int,int,int)
         -10 (-0.81% of base) : 214442.dasm - System.Security.Cryptography.X509Certificates.RSAPssX509SignatureGenerator:GetSignatureAlgorithmIdentifier(System.Security.Cryptography.HashAlgorithmName):System.Byte[]:this

49 total methods with Code Size differences (26 improved, 23 regressed), 15 unchanged.


Tests PMI

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 49730
Total bytes of diff: 49117
Total bytes of delta: -613 (-1.23% of base)
    diff is an improvement.
Detail diffs


Top file regressions (bytes):
          11 : 243246.dasm (0.48% of base)
           7 : 212940.dasm (2.19% of base)

Top file improvements (bytes):
         -87 : 235489.dasm (-6.91% of base)
         -84 : 86198.dasm (-37.17% of base)
         -82 : 235483.dasm (-2.37% of base)
         -68 : 232733.dasm (-0.54% of base)
         -60 : 168432.dasm (-0.95% of base)
         -46 : 232659.dasm (-0.53% of base)
         -36 : 232726.dasm (-1.68% of base)
         -26 : 235479.dasm (-0.90% of base)
         -25 : 210172.dasm (-3.01% of base)
         -24 : 232805.dasm (-0.51% of base)
         -23 : 232650.dasm (-1.45% of base)
         -21 : 232679.dasm (-5.66% of base)
         -19 : 86177.dasm (-9.60% of base)
         -14 : 235486.dasm (-1.44% of base)
         -12 : 232598.dasm (-5.36% of base)
          -4 : 210424.dasm (-3.23% of base)

18 total files with Code Size differences (16 improved, 2 regressed), 4 unchanged.

Top method regressions (bytes):
          11 ( 0.48% of base) : 243246.dasm - StrAccess1:Main(System.String[]):int
           7 ( 2.19% of base) : 212940.dasm - Instance:GC(System.Object,int,System.Object,System.Object,System.String,System.String,System.Object,int,byref):System.String:this

Top method improvements (bytes):
         -87 (-6.91% of base) : 235489.dasm - JitTest.LCSV:findLCS(JitTest.LCSV[,,,],JitTest.LCSV[,,,],System.Char[][],JitTest.LCSV[])
         -84 (-37.17% of base) : 86198.dasm - JitTest.CI:Main():int
         -82 (-2.37% of base) : 235483.dasm - JitTest.LCSV:findLCS(JitTest.LCSV[,,,],JitTest.LCSV[,,,],System.Char[][],JitTest.LCSV[])
         -68 (-0.54% of base) : 232733.dasm - filter3:f25(int)
         -60 (-0.95% of base) : 168432.dasm - Managed:MarshalStructAsParam_AsSeqByVal(int)
         -46 (-0.53% of base) : 232659.dasm - catch3:f25(int)
         -36 (-1.68% of base) : 232726.dasm - filter2:f11()
         -26 (-0.90% of base) : 235479.dasm - JitTest.LCSV:findLCS(JitTest.LCSV[,,,],JitTest.LCSV[,,,],System.Char[][],JitTest.LCSV[])
         -25 (-3.01% of base) : 210172.dasm - Test:RunTest1(System.String)
         -24 (-0.51% of base) : 232805.dasm - try3:f25(int)
         -23 (-1.45% of base) : 232650.dasm - catch2:f11()
         -21 (-5.66% of base) : 232679.dasm - filter1:f15()
         -19 (-9.60% of base) : 86177.dasm - MS.VT:sub(MS.VT,MS.VT):MS.VT
         -14 (-1.44% of base) : 235486.dasm - JitTest.LCSV:findLCS(JitTest.LCSV[,,,],JitTest.LCSV[,,,],System.Char[][],JitTest.LCSV[])
         -12 (-5.36% of base) : 232598.dasm - catch1:f15()
          -4 (-3.23% of base) : 210424.dasm - Nested1:Get():Nested1

Top method regressions (percentages):
           7 ( 2.19% of base) : 212940.dasm - Instance:GC(System.Object,int,System.Object,System.Object,System.String,System.String,System.Object,int,byref):System.String:this
          11 ( 0.48% of base) : 243246.dasm - StrAccess1:Main(System.String[]):int

Top method improvements (percentages):
         -84 (-37.17% of base) : 86198.dasm - JitTest.CI:Main():int
         -19 (-9.60% of base) : 86177.dasm - MS.VT:sub(MS.VT,MS.VT):MS.VT
         -87 (-6.91% of base) : 235489.dasm - JitTest.LCSV:findLCS(JitTest.LCSV[,,,],JitTest.LCSV[,,,],System.Char[][],JitTest.LCSV[])
         -21 (-5.66% of base) : 232679.dasm - filter1:f15()
         -12 (-5.36% of base) : 232598.dasm - catch1:f15()
          -4 (-3.23% of base) : 210424.dasm - Nested1:Get():Nested1
         -25 (-3.01% of base) : 210172.dasm - Test:RunTest1(System.String)
         -82 (-2.37% of base) : 235483.dasm - JitTest.LCSV:findLCS(JitTest.LCSV[,,,],JitTest.LCSV[,,,],System.Char[][],JitTest.LCSV[])
         -36 (-1.68% of base) : 232726.dasm - filter2:f11()
         -23 (-1.45% of base) : 232650.dasm - catch2:f11()
         -14 (-1.44% of base) : 235486.dasm - JitTest.LCSV:findLCS(JitTest.LCSV[,,,],JitTest.LCSV[,,,],System.Char[][],JitTest.LCSV[])
         -60 (-0.95% of base) : 168432.dasm - Managed:MarshalStructAsParam_AsSeqByVal(int)
         -26 (-0.90% of base) : 235479.dasm - JitTest.LCSV:findLCS(JitTest.LCSV[,,,],JitTest.LCSV[,,,],System.Char[][],JitTest.LCSV[])
         -68 (-0.54% of base) : 232733.dasm - filter3:f25(int)
         -46 (-0.53% of base) : 232659.dasm - catch3:f25(int)
         -24 (-0.51% of base) : 232805.dasm - try3:f25(int)

18 total methods with Code Size differences (16 improved, 2 regressed), 4 unchanged.


@AndyAyersMS
Copy link
Member Author

fyi @stephentoub, still apparently simple.

Copy link
Contributor

@briansull briansull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good

@AndyAyersMS AndyAyersMS merged commit 6d098da into dotnet:main Apr 14, 2021
@AndyAyersMS AndyAyersMS deleted the SmarterSpillStfld branch April 14, 2021 19:18
@JulieLeeMSFT JulieLeeMSFT added this to the 6.0.0 milestone Apr 15, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants