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

Reserve memory for FOH in-range #78292

Merged
merged 5 commits into from
Dec 6, 2022
Merged

Reserve memory for FOH in-range #78292

merged 5 commits into from
Dec 6, 2022

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Nov 13, 2022

This should allow jit to use relocs (mainly, for boxed statics), e.g.:

static DateTime Date { get; set; }

Codegen for getter (same for setter):
Previously (after #77737):

; Assembly listing for method get_Date()
       48B8901762B29D020000 mov      rax, 0x29DB2621790
       488B00               mov      rax, qword ptr [rax]
       C3                   ret
; Total bytes of code 14

New codegen:

; Assembly listing for method get_Date()
       488B0571E41000       mov      rax, qword ptr [(reloc 0x7fff54fc17b8)]
       C3                   ret
; Total bytes of code 8

jit-diff (-f --pmi --cctors):

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 58930581
Total bytes of diff: 58879402
Total bytes of delta: -51179 (-0.09 % of base)
Total relative delta: -378.96
    diff is an improvement.
    relative diff is an improvement.


Total byte diff includes 206 bytes from reconciling methods
        Base had    0 unique methods,        0 unique bytes
        Diff had    2 unique methods,      206 unique bytes

Top file regressions (bytes):
         164 : Microsoft.CodeAnalysis.dasm (0.01% of base)

Top file improvements (bytes):
      -46542 : Microsoft.Diagnostics.Tracing.TraceEvent.dasm (-1.28% of base)
        -834 : Newtonsoft.Json.dasm (-0.09% of base)
        -729 : System.Private.Xml.dasm (-0.02% of base)
        -708 : System.Reflection.DispatchProxy.dasm (-3.03% of base)
        -311 : System.Data.Common.dasm (-0.02% of base)
        -306 : Microsoft.Extensions.DependencyInjection.dasm (-0.49% of base)
        -297 : System.Data.OleDb.dasm (-0.09% of base)
        -294 : System.Private.CoreLib.dasm (-0.02% of base)
        -240 : FSharp.Core.dasm (-0.01% of base)
        -192 : System.Composition.Hosting.dasm (-0.22% of base)
        -102 : System.Composition.TypedParts.dasm (-0.19% of base)
         -90 : System.Linq.Expressions.dasm (-0.01% of base)
         -84 : System.Threading.RateLimiting.dasm (-0.05% of base)
         -54 : OSExtensions.dasm (-0.52% of base)
         -48 : System.ComponentModel.TypeConverter.dasm (-0.02% of base)
         -48 : System.Security.Cryptography.dasm (-0.01% of base)
         -40 : System.Speech.dasm (-0.01% of base)
         -36 : System.Net.Sockets.dasm (-0.02% of base)
         -30 : System.Console.dasm (-0.05% of base)
         -30 : Microsoft.CodeAnalysis.CSharp.dasm (-0.00% of base)
         -30 : System.Runtime.Caching.dasm (-0.05% of base)
         -30 : System.Transactions.Local.dasm (-0.01% of base)
         -24 : Microsoft.Extensions.DependencyInjection.Abstractions.dasm (-0.09% of base)
         -24 : Microsoft.Extensions.FileProviders.Physical.dasm (-0.14% of base)
         -24 : System.Diagnostics.EventLog.dasm (-0.02% of base)

4929 total methods with Code Size differences (4921 improved, 8 regressed), 355176 unchanged.

Not sure it's guaranteed to return 8-bytes aligned memory though.

@EgorBo EgorBo marked this pull request as ready for review November 14, 2022 00:47
@EgorBo EgorBo merged commit 360d405 into dotnet:main Dec 6, 2022
@EgorBo EgorBo deleted the foh-in-range branch December 6, 2022 23:20
@cshung cshung mentioned this pull request Jan 3, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jan 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants