Skip to content

Conversation

@jkotas
Copy link
Member

@jkotas jkotas commented Oct 18, 2022

This enables AOT initialization of public readonly DateTime statics like DateTime.Min/MaxValue.

… class

This enables AOT initialization of public readonly DateTime statics like DateTime.Min/MaxValue.
@ghost
Copy link

ghost commented Oct 18, 2022

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost assigned jkotas Oct 18, 2022
@jkotas jkotas changed the title Move leap seconds DateTime configuration statics into LeapSecondCache… Move leap seconds DateTime configuration statics into LeapSecondCache Oct 18, 2022
@jkotas
Copy link
Member Author

jkotas commented Oct 18, 2022

Context: #77102 (comment)

@EgorBo
Copy link
Member

EgorBo commented Oct 18, 2022

Thanks, validate locally with changes from #77102 that this:

static bool Test(DateTime dt) => dt == DateTime.MinValue;

Emits:

; Assembly listing for method Program:Test(System.DateTime):bool
; Emitting BLENDED_CODE for X64 CPU with SSE2 - Windows
; ReadyToRun compilation
; optimized code
; rsp based frame
; partially interruptible
; Final local variable assignments
;
;* V00 arg0         [V00    ] (  0,  0   )  struct ( 8) zero-ref    single-def
;# V01 OutArgs      [V01    ] (  1,  1   )  lclBlk ( 0) [rsp+00H]   "OutgoingArgSpace"
;* V02 tmp1         [V02    ] (  0,  0   )  struct ( 8) zero-ref    "folding static ro fld struct"
;* V03 tmp2         [V03    ] (  0,  0   )  struct ( 8) zero-ref    "Inlining Arg"
;* V04 tmp3         [V04    ] (  0,  0   )  struct ( 8) zero-ref    "Inlining Arg"
;  V05 tmp4         [V05,T00] (  2,  2   )    long  ->  rcx         single-def V00._dateData(offs=0x00) P-INDEP "field V00._dateData (fldOffset=0x0)"
;* V06 tmp5         [V06    ] (  0,  0   )    long  ->  zero-ref    V02._dateData(offs=0x00) P-INDEP "field V02._dateData (fldOffset=0x0)"
;* V07 tmp6         [V07    ] (  0,  0   )    long  ->  zero-ref    V03._dateData(offs=0x00) P-INDEP "field V03._dateData (fldOffset=0x0)"
;* V08 tmp7         [V08    ] (  0,  0   )    long  ->  zero-ref    V04._dateData(offs=0x00) P-INDEP "field V04._dateData (fldOffset=0x0)"
;
; Lcl frame size = 0

G_M44292_IG01:              ;; offset=0000H
						;; size=0 bbWeight=1    PerfScore 0.00
G_M44292_IG02:              ;; offset=0000H
       48C1E102             shl      rcx, 2
       0F94C0               sete     al
       0FB6C0               movzx    rax, al
						;; size=10 bbWeight=1    PerfScore 1.75
G_M44292_IG03:              ;; offset=000AH
       C3                   ret      
						;; size=1 bbWeight=1    PerfScore 1.00

; Total bytes of code 11, prolog size 0, PerfScore 3.85, instruction count 4, allocated bytes for code 11 (MethodHash=313f52fb) for method Program:Test(System.DateTime):bool
; ============================================================

on NativeAOT

@jkotas jkotas merged commit 570b373 into dotnet:main Oct 18, 2022
@jkotas jkotas deleted the datetime branch October 18, 2022 19:55
@ghost ghost locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants