Skip to content

[JitDiff X64] [EgorBo] Remove unsafe code from DCS utilities (UniqueId, XmlB ... #1870

Open

Description

@MihuBot

Job completed in 4 minutes 23 seconds (remote runner delay: 0 seconds).
dotnet/runtime#127539

Main commit: dotnet/runtime@9a6034a
PR commit: EgorBo/runtime-1@2de24a3

Diffs

Found 84 files with textual diffs.

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 46196840
Total bytes of diff: 46196674
Total bytes of delta: -166 (-0.00 % of base)
Total relative delta: -0.33
    diff is an improvement.
    relative diff is an improvement.


Top file improvements (bytes):
        -166 : System.Private.DataContractSerialization.dasm (-0.02 % of base)

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

Top method improvements (bytes):
        -120 (-21.86 % of base) : System.Private.DataContractSerialization.dasm - System.Xml.UniqueId:TryGetGuid(byte[],int):bool:this (FullOpts)
         -46 (-10.85 % of base) : System.Private.DataContractSerialization.dasm - System.Xml.UniqueId:.ctor(byte[],int):this (FullOpts)

Top method improvements (percentages):
        -120 (-21.86 % of base) : System.Private.DataContractSerialization.dasm - System.Xml.UniqueId:TryGetGuid(byte[],int):bool:this (FullOpts)
         -46 (-10.85 % of base) : System.Private.DataContractSerialization.dasm - System.Xml.UniqueId:.ctor(byte[],int):this (FullOpts)

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

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

Artifacts:

Activity

  1. MihuBot commented on Apr 29, 2026

    @MihuBot
    OwnerAuthor

    Top method improvements

    -120 (-21.86 % of base) - System.Xml.UniqueId:TryGetGuid(byte[],int):bool:this
     ; Assembly listing for method System.Xml.UniqueId:TryGetGuid(byte[],int):bool:this (FullOpts)
     ; Emitting BLENDED_CODE for x64 + VEX + EVEX on Unix
     ; FullOpts code
     ; optimized code
     ; rbp based frame
     ; partially interruptible
     ; No PGO data
    -; 0 inlinees with PGO data; 3 single block inlinees; 2 inlinees without PGO data
    +; 0 inlinees with PGO data; 5 single block inlinees; 8 inlinees without PGO data
     ; Final local variable assignments
     ;
    -;  V00 this         [V00,T00] (  9,  6   )     ref  ->  rbx         this class-hnd single-def <System.Xml.UniqueId>
    +;  V00 this         [V00,T01] (  5,  4   )     ref  ->  r15         this class-hnd single-def <System.Xml.UniqueId>
     ;  V01 arg1         [V01,T02] (  5,  3.50)     ref  ->  r14         class-hnd single-def <byte[]>
    -;  V02 arg2         [V02,T01] (  8,  4.50)     int  ->  r15         single-def
    -;* V03 loc0         [V03    ] (  0,  0   )    long  ->  zero-ref   
    -;  V04 loc1         [V04    ] (  3,  1.50)   byref  ->  [rbp-0x28]  must-init pinned
    -;# V05 OutArgs      [V05    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace" <Empty>
    -;  V06 tmp1         [V06,T08] (  3,  0   )     ref  ->  rbx         class-hnd exact single-def "Single-def Box Helper" <System.Int32>
    -;  V07 tmp2         [V07,T12] (  2,  0   )     ref  ->  r15         class-hnd exact single-def "impImportAndPushBox" <System.String>
    -;  V08 tmp3         [V08,T09] (  3,  0   )     ref  ->  r14         class-hnd exact single-def "NewObj constructor temp" <System.ArgumentOutOfRangeException>
    -;  V09 tmp4         [V09,T10] (  3,  0   )     ref  ->  rbx         class-hnd exact single-def "Single-def Box Helper" <System.Int32>
    -;  V10 tmp5         [V10,T13] (  2,  0   )     ref  ->  r15         class-hnd exact single-def "impImportAndPushBox" <System.String>
    -;  V11 tmp6         [V11,T11] (  3,  0   )     ref  ->  r14         class-hnd exact single-def "NewObj constructor temp" <System.ArgumentOutOfRangeException>
    -;  V12 tmp7         [V12,T04] (  3,  3   )    long  ->  r15         "Inlining Arg"
    -;  V13 tmp8         [V13,T05] (  3,  3   )    long  ->  r15         "Inlining Arg"
    -;  V14 tmp9         [V14,T06] (  3,  3   )    long  ->  r13         "Inlining Arg"
    -;  V15 tmp10        [V15,T03] (  4,  4   )    long  ->  r13         "Cast away GC"
    -;  V16 tmp11        [V16,T14] (  2,  0   )     ref  ->  rdx         single-def "argument with side effect"
    -;  V17 tmp12        [V17,T15] (  2,  0   )     ref  ->  rdx         single-def "argument with side effect"
    -;  V18 cse0         [V18,T07] (  5,  2   )     int  ->  r13         "CSE #01: aggressive"
    +;  V02 arg2         [V02,T00] (  8,  4.50)     int  ->  rbx         single-def
    +;* V03 loc0         [V03    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.Span`1[byte]>
    +;# V04 OutArgs      [V04    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace" <Empty>
    +;* V05 tmp1         [V05    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.Span`1[byte]>
    +;  V06 tmp2         [V06,T08] (  3,  0   )     ref  ->  r13         class-hnd exact single-def "Single-def Box Helper" <System.Int32>
    +;  V07 tmp3         [V07,T12] (  2,  0   )     ref  ->  rbx         class-hnd exact single-def "impImportAndPushBox" <System.String>
    +;  V08 tmp4         [V08,T09] (  3,  0   )     ref  ->  r15         class-hnd exact single-def "NewObj constructor temp" <System.ArgumentOutOfRangeException>
    +;  V09 tmp5         [V09,T10] (  3,  0   )     ref  ->  rbx         class-hnd exact single-def "Single-def Box Helper" <System.Int32>
    +;  V10 tmp6         [V10,T13] (  2,  0   )     ref  ->  r15         class-hnd exact single-def "impImportAndPushBox" <System.String>
    +;  V11 tmp7         [V11,T11] (  3,  0   )     ref  ->  r14         class-hnd exact single-def "NewObj constructor temp" <System.ArgumentOutOfRangeException>
    +;* V12 tmp8         [V12    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.Span`1[byte]>
    +;* V13 tmp9         [V13    ] (  0,  0   )  struct (16) zero-ref    "Inlining Arg" <System.Span`1[byte]>
    +;  V14 tmp10        [V14,T05] (  2,  2   )    long  ->  rcx         ld-addr-op "Inlining Arg"
    +;* V15 tmp11        [V15    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[byte]>
    +;* V16 tmp12        [V16    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[byte]>
    +;* V17 tmp13        [V17    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.Span`1[byte]>
    +;  V18 tmp14        [V18,T04] (  2,  2   )   byref  ->  rax         single-def "Inlining Arg"
    +;* V19 tmp15        [V19    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
    +;  V20 tmp16        [V20,T06] (  2,  2   )    long  ->  rcx         ld-addr-op "Inlining Arg"
    +;* V21 tmp17        [V21    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[byte]>
    +;* V22 tmp18        [V22    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[byte]>
    +;* V23 tmp19        [V23    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V03._reference (fldOffset=0x0)" P-INDEP
    +;* V24 tmp20        [V24    ] (  0,  0   )     int  ->  zero-ref    "field V03._length (fldOffset=0x8)" P-INDEP
    +;* V25 tmp21        [V25    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V05._reference (fldOffset=0x0)" P-INDEP
    +;* V26 tmp22        [V26    ] (  0,  0   )     int  ->  zero-ref    "field V05._length (fldOffset=0x8)" P-INDEP
    +;  V27 tmp23        [V27,T07] (  3,  1.50)   byref  ->  rax         single-def "field V12._reference (fldOffset=0x0)" P-INDEP
    +;* V28 tmp24        [V28    ] (  0,  0   )     int  ->  zero-ref    "field V12._length (fldOffset=0x8)" P-INDEP
    +;* V29 tmp25        [V29    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V13._reference (fldOffset=0x0)" P-INDEP
    +;* V30 tmp26        [V30    ] (  0,  0   )     int  ->  zero-ref    "field V13._length (fldOffset=0x8)" P-INDEP
    +;* V31 tmp27        [V31    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V15._reference (fldOffset=0x0)" P-INDEP
    +;* V32 tmp28        [V32    ] (  0,  0   )     int  ->  zero-ref    "field V15._length (fldOffset=0x8)" P-INDEP
    +;* V33 tmp29        [V33    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V16._reference (fldOffset=0x0)" P-INDEP
    +;* V34 tmp30        [V34    ] (  0,  0   )     int  ->  zero-ref    "field V16._length (fldOffset=0x8)" P-INDEP
    +;* V35 tmp31        [V35    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V17._reference (fldOffset=0x0)" P-INDEP
    +;* V36 tmp32        [V36    ] (  0,  0   )     int  ->  zero-ref    "field V17._length (fldOffset=0x8)" P-INDEP
    +;* V37 tmp33        [V37    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V21._reference (fldOffset=0x0)" P-INDEP
    +;* V38 tmp34        [V38    ] (  0,  0   )     int  ->  zero-ref    "field V21._length (fldOffset=0x8)" P-INDEP
    +;* V39 tmp35        [V39    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V22._reference (fldOffset=0x0)" P-INDEP
    +;* V40 tmp36        [V40    ] (  0,  0   )     int  ->  zero-ref    "field V22._length (fldOffset=0x8)" P-INDEP
    +;  V41 tmp37        [V41,T14] (  2,  0   )     ref  ->  rdx         single-def "argument with side effect"
    +;  V42 tmp38        [V42,T15] (  2,  0   )     ref  ->  rdx         single-def "argument with side effect"
    +;  V43 cse0         [V43,T03] (  5,  2   )     int  ->  r13         "CSE #01: aggressive"
     ;
    -; Lcl frame size = 16
    +; Lcl frame size = 0
     
     G_M28622_IG01:
            push     rbp
            push     r15
            push     r14
            push     r13
            push     rbx
    -       sub      rsp, 16
    -       lea      rbp, [rsp+0x30]
    -       xor      eax, eax
    -       mov      qword ptr [rbp-0x28], rax
    -       mov      rbx, rdi
    +       lea      rbp, [rsp+0x20]
    +       mov      r15, rdi
            mov      r14, rsi
    -       mov      r15d, edx
    -						;; size=32 bbWeight=1 PerfScore 7.75
    +       mov      ebx, edx
    +						;; size=21 bbWeight=1 PerfScore 6.25
     G_M28622_IG02:
    -       mov      rdi, rbx
    +       mov      rdi, r15
            mov      rax, 0xD1FFAB1E      ; code for System.Xml.UniqueId:get_IsGuid():bool:this
            call     [rax]System.Xml.UniqueId:get_IsGuid():bool:this
            test     eax, eax
    -       je       G_M28622_IG05
    -						;; size=23 bbWeight=1 PerfScore 4.75
    +       je       SHORT G_M28622_IG05
    +						;; size=19 bbWeight=1 PerfScore 4.75
     G_M28622_IG03:
            test     r14, r14
    -       je       G_M28622_IG07
    -       test     r15d, r15d
    -       jl       G_M28622_IG08
    +       je       SHORT G_M28622_IG07
    +       test     ebx, ebx
    +       jl       SHORT G_M28622_IG08
            mov      r13d, dword ptr [r14+0x08]
    -       cmp      r13d, r15d
    +       cmp      r13d, ebx
            jl       G_M28622_IG09
    -       mov      edi, r13d
    -       sub      edi, r15d
    -       cmp      edi, 16
    +       mov      eax, r13d
    +       sub      eax, ebx
    +       cmp      eax, 16
            jl       G_M28622_IG10
    -       cmp      r15d, r13d
    -       jae      G_M28622_IG11
    -       mov      edi, r15d
    -       lea      rdi, bword ptr [r14+rdi+0x10]
    -       mov      bword ptr [rbp-0x28], rdi
    -       mov      r13, bword ptr [rbp-0x28]
    -       mov      r15, qword ptr [rbx+0x10]
    -       mov      rdi, rbx
    -       mov      esi, r15d
    -       mov      rdx, r13
    -       mov      rax, 0xD1FFAB1E      ; code for System.Xml.UniqueId:UnsafeSetInt32(int,ptr):this
    -       call     [rax]System.Xml.UniqueId:UnsafeSetInt32(int,ptr):this
    -       mov      rsi, r15
    -       sar      rsi, 32
    -       lea      rdx, [r13+0x04]
    -       mov      rdi, rbx
    -       mov      rax, 0xD1FFAB1E      ; code for System.Xml.UniqueId:UnsafeSetInt32(int,ptr):this
    -       call     [rax]System.Xml.UniqueId:UnsafeSetInt32(int,ptr):this
    -       mov      r15, qword ptr [rbx+0x18]
    -       add      r13, 8
    -       mov      rdi, rbx
    -       mov      esi, r15d
    -       mov      rdx, r13
    -       mov      rax, 0xD1FFAB1E      ; code for System.Xml.UniqueId:UnsafeSetInt32(int,ptr):this
    -       call     [rax]System.Xml.UniqueId:UnsafeSetInt32(int,ptr):this
    -       mov      rsi, r15
    -       sar      rsi, 32
    -       lea      rdx, [r13+0x04]
    -       mov      rdi, rbx
    -       mov      rax, 0xD1FFAB1E      ; code for System.Xml.UniqueId:UnsafeSetInt32(int,ptr):this
    -       call     [rax]System.Xml.UniqueId:UnsafeSetInt32(int,ptr):this
    -       xor      eax, eax
    -       mov      bword ptr [rbp-0x28], rax
    +       mov      eax, r13d
    +       mov      ecx, ebx
    +       add      rcx, 16
    +       cmp      rax, rcx
    +       jb       G_M28622_IG11
    +       mov      eax, ebx
    +       lea      rax, bword ptr [r14+rax+0x10]
    +       mov      rcx, qword ptr [r15+0x10]
    +       mov      qword ptr [rax], rcx
    +       add      rax, 8
    +       mov      rcx, qword ptr [r15+0x18]
    +       mov      qword ptr [rax], rcx
            mov      eax, 1
    -						;; size=188 bbWeight=0.50 PerfScore 17.62
    +						;; size=84 bbWeight=0.50 PerfScore 8.62
     G_M28622_IG04:
    -       add      rsp, 16
            pop      rbx
            pop      r13
            pop      r14
            pop      r15
            pop      rbp
            ret      
    -						;; size=13 bbWeight=0.50 PerfScore 1.88
    +						;; size=9 bbWeight=0.50 PerfScore 1.75
     G_M28622_IG05:
            xor      eax, eax
     						;; size=2 bbWeight=0.50 PerfScore 0.12
     G_M28622_IG06:
    -       add      rsp, 16
            pop      rbx
            pop      r13
            pop      r14
            pop      r15
            pop      rbp
            ret      
    -						;; size=13 bbWeight=0.50 PerfScore 1.88
    +						;; size=9 bbWeight=0.50 PerfScore 1.75
     G_M28622_IG07:
            mov      rdi, 0xD1FFAB1E      ; 'buffer'
            mov      rax, 0xD1FFAB1E      ; code for System.ArgumentNullException:Throw(System.String)
            call     [rax]System.ArgumentNullException:Throw(System.String)
            int3     
     						;; size=23 bbWeight=0 PerfScore 0.00
     G_M28622_IG08:
    -       mov      edi, r15d
    +       mov      edi, ebx
            mov      rsi, 0xD1FFAB1E      ; 'offset'
            mov      rax, 0xD1FFAB1E      ; code for System.ArgumentOutOfRangeException:ThrowNegative[int](int,System.String)
            call     [rax]System.ArgumentOutOfRangeException:ThrowNegative[int](int,System.String)
            int3     
    -						;; size=26 bbWeight=0 PerfScore 0.00
    +						;; size=25 bbWeight=0 PerfScore 0.00
     G_M28622_IG09:
            mov      rdi, 0xD1FFAB1E      ; System.Int32
            call     CORINFO_HELP_NEWSFAST
            mov      rbx, rax
            mov      rax, 0xD1FFAB1E      ; code for System.SR:get_OffsetExceedsBufferSize():System.String
            call     [rax]System.SR:get_OffsetExceedsBufferSize():System.String
            mov      r15, rax
            mov      dword ptr [rbx+0x08], r13d
            mov      rdi, 0xD1FFAB1E      ; System.ArgumentOutOfRangeException
            call     CORINFO_HELP_NEWSFAST
            mov      r14, rax
            mov      rsi, rbx
            mov      rdi, r15
            mov      rax, 0xD1FFAB1E      ; code for System.SR:Format(System.String,System.Object):System.String
            call     [rax]System.SR:Format(System.String,System.Object):System.String
            mov      rdx, rax
            mov      rdi, r14
            mov      rsi, 0xD1FFAB1E      ; 'offset'
            mov      rax, 0xD1FFAB1E      ; code for System.ArgumentOutOfRangeException:.ctor(System.String,System.String):this
            call     [rax]System.ArgumentOutOfRangeException:.ctor(System.String,System.String):this
            mov      rdi, r14
            call     CORINFO_HELP_THROW
            int3     
     						;; size=110 bbWeight=0 PerfScore 0.00
     G_M28622_IG10:
            mov      rdi, 0xD1FFAB1E      ; System.Int32
            call     CORINFO_HELP_NEWSFAST
    -       mov      rbx, rax
    +       mov      r13, rax
            mov      rax, 0xD1FFAB1E      ; code for System.SR:get_XmlArrayTooSmallOutput():System.String
            call     [rax]System.SR:get_XmlArrayTooSmallOutput():System.String
    -       mov      r15, rax
    -       mov      dword ptr [rbx+0x08], 16
    +       mov      rbx, rax
    +       mov      dword ptr [r13+0x08], 16
            mov      rdi, 0xD1FFAB1E      ; System.ArgumentOutOfRangeException
            call     CORINFO_HELP_NEWSFAST
    -       mov      r14, rax
    -       mov      rsi, rbx
    -       mov      rdi, r15
    +       mov      r15, rax
    +       mov      rsi, r13
    +       mov      rdi, rbx
            mov      rax, 0xD1FFAB1E      ; code for System.SR:Format(System.String,System.Object):System.String
            call     [rax]System.SR:Format(System.String,System.Object):System.String
            mov      rdx, rax
    -       mov      rdi, r14
    +       mov      rdi, r15
            mov      rsi, 0xD1FFAB1E      ; 'buffer'
            mov      rax, 0xD1FFAB1E      ; code for System.ArgumentOutOfRangeException:.ctor(System.String,System.String):this
            call     [rax]System.ArgumentOutOfRangeException:.ctor(System.String,System.String):this
    -       mov      rdi, r14
    +       mov      rdi, r15
            call     CORINFO_HELP_THROW
            int3     
    -						;; size=113 bbWeight=0 PerfScore 0.00
    +						;; size=114 bbWeight=0 PerfScore 0.00
     G_M28622_IG11:
    -       call     CORINFO_HELP_RNGCHKFAIL
    +       mov      rax, 0xD1FFAB1E      ; code for System.ThrowHelper:ThrowArgumentOutOfRangeException()
    +       call     [rax]System.ThrowHelper:ThrowArgumentOutOfRangeException()
            int3     
    -						;; size=6 bbWeight=0 PerfScore 0.00
    +						;; size=13 bbWeight=0 PerfScore 0.00
     
    -; Total bytes of code 549, prolog size 23, PerfScore 34.00, instruction count 132, allocated bytes for code 549 (MethodHash=ecbb9031) for method System.Xml.UniqueId:TryGetGuid(byte[],int):bool:this (FullOpts)
    +; Total bytes of code 429, prolog size 13, PerfScore 23.25, instruction count 107, allocated bytes for code 429 (MethodHash=ecbb9031) for method System.Xml.UniqueId:TryGetGuid(byte[],int):bool:this (FullOpts)
     ; ============================================================
    -46 (-10.85 % of base) - System.Xml.UniqueId:.ctor(byte[],int):this
     ; Assembly listing for method System.Xml.UniqueId:.ctor(byte[],int):this (FullOpts)
     ; Emitting BLENDED_CODE for x64 + VEX + EVEX on Unix
     ; FullOpts code
     ; optimized code
     ; rbp based frame
     ; partially interruptible
     ; No PGO data
    -; 0 inlinees with PGO data; 2 single block inlinees; 2 inlinees without PGO data
    +; 0 inlinees with PGO data; 10 single block inlinees; 6 inlinees without PGO data
     ; Final local variable assignments
     ;
    -;  V00 this         [V00,T01] (  6,  6   )     ref  ->  rbx         this class-hnd single-def <System.Xml.UniqueId>
    -;  V01 arg1         [V01,T02] (  5,  5   )     ref  ->  rsi         class-hnd single-def <byte[]>
    +;  V00 this         [V00,T02] (  4,  4   )     ref  ->  rdi         this class-hnd single-def <System.Xml.UniqueId>
    +;  V01 arg1         [V01,T01] (  5,  5   )     ref  ->  rsi         class-hnd single-def <byte[]>
     ;  V02 arg2         [V02,T00] (  8,  7   )     int  ->  rdx         single-def
    -;* V03 loc0         [V03    ] (  0,  0   )    long  ->  zero-ref   
    -;  V04 loc1         [V04    ] (  3,  3   )   byref  ->  [rbp-0x20]  must-init pinned
    -;# V05 OutArgs      [V05    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace" <Empty>
    -;  V06 tmp1         [V06,T05] (  3,  0   )     ref  ->  rbx         class-hnd exact single-def "Single-def Box Helper" <System.Int32>
    -;  V07 tmp2         [V07,T09] (  2,  0   )     ref  ->  r15         class-hnd exact single-def "impImportAndPushBox" <System.String>
    -;  V08 tmp3         [V08,T06] (  3,  0   )     ref  ->  r14         class-hnd exact single-def "NewObj constructor temp" <System.ArgumentException>
    -;  V09 tmp4         [V09,T07] (  3,  0   )     ref  ->  rbx         class-hnd exact single-def "Single-def Box Helper" <System.Int32>
    -;  V10 tmp5         [V10,T10] (  2,  0   )     ref  ->  r14         class-hnd exact single-def "impImportAndPushBox" <System.String>
    -;  V11 tmp6         [V11,T08] (  3,  0   )     ref  ->  r15         class-hnd exact single-def "NewObj constructor temp" <System.ArgumentOutOfRangeException>
    -;  V12 tmp7         [V12,T03] (  3,  6   )    long  ->  r15         "Cast away GC"
    -;  V13 tmp8         [V13,T11] (  2,  0   )     ref  ->  rsi         single-def "argument with side effect"
    -;  V14 tmp9         [V14,T12] (  2,  0   )     ref  ->  rdx         single-def "argument with side effect"
    -;  V15 cse0         [V15,T04] (  5,  4   )     int  ->  r15         "CSE #01: aggressive"
    +;* V03 loc0         [V03    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.ReadOnlySpan`1[byte]>
    +;# V04 OutArgs      [V04    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace" <Empty>
    +;* V05 tmp1         [V05    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.Span`1[byte]>
    +;* V06 tmp2         [V06    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.ReadOnlySpan`1[byte]>
    +;  V07 tmp3         [V07,T06] (  3,  0   )     ref  ->  rbx         class-hnd exact single-def "Single-def Box Helper" <System.Int32>
    +;  V08 tmp4         [V08,T10] (  2,  0   )     ref  ->  r15         class-hnd exact single-def "impImportAndPushBox" <System.String>
    +;  V09 tmp5         [V09,T07] (  3,  0   )     ref  ->  r14         class-hnd exact single-def "NewObj constructor temp" <System.ArgumentException>
    +;  V10 tmp6         [V10,T08] (  3,  0   )     ref  ->  r15         class-hnd exact single-def "Single-def Box Helper" <System.Int32>
    +;  V11 tmp7         [V11,T11] (  2,  0   )     ref  ->  r14         class-hnd exact single-def "impImportAndPushBox" <System.String>
    +;  V12 tmp8         [V12,T09] (  3,  0   )     ref  ->  rbx         class-hnd exact single-def "NewObj constructor temp" <System.ArgumentOutOfRangeException>
    +;* V13 tmp9         [V13    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.Span`1[byte]>
    +;* V14 tmp10        [V14    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[byte]>
    +;* V15 tmp11        [V15    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[byte]>
    +;* V16 tmp12        [V16    ] (  0,  0   )   byref  ->  zero-ref    single-def "Inlining Arg"
    +;* V17 tmp13        [V17    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
    +;* V18 tmp14        [V18    ] (  0,  0   )  struct (16) zero-ref    "Inlining Arg" <System.ReadOnlySpan`1[byte]>
    +;* V19 tmp15        [V19    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[byte]>
    +;* V20 tmp16        [V20    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[byte]>
    +;* V21 tmp17        [V21    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[byte]>
    +;  V22 tmp18        [V22,T04] (  2,  4   )   byref  ->  rax         single-def "Inlining Arg"
    +;* V23 tmp19        [V23    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
    +;* V24 tmp20        [V24    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[byte]>
    +;* V25 tmp21        [V25    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[byte]>
    +;* V26 tmp22        [V26    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V03._reference (fldOffset=0x0)" P-INDEP
    +;* V27 tmp23        [V27    ] (  0,  0   )     int  ->  zero-ref    "field V03._length (fldOffset=0x8)" P-INDEP
    +;* V28 tmp24        [V28    ] (  0,  0   )   byref  ->  zero-ref    "field V05._reference (fldOffset=0x0)" P-INDEP
    +;* V29 tmp25        [V29    ] (  0,  0   )     int  ->  zero-ref    "field V05._length (fldOffset=0x8)" P-INDEP
    +;* V30 tmp26        [V30    ] (  0,  0   )   byref  ->  zero-ref    "field V06._reference (fldOffset=0x0)" P-INDEP
    +;* V31 tmp27        [V31    ] (  0,  0   )     int  ->  zero-ref    "field V06._length (fldOffset=0x8)" P-INDEP
    +;  V32 tmp28        [V32,T05] (  3,  3   )   byref  ->  rax         single-def "field V13._reference (fldOffset=0x0)" P-INDEP
    +;* V33 tmp29        [V33    ] (  0,  0   )     int  ->  zero-ref    "field V13._length (fldOffset=0x8)" P-INDEP
    +;* V34 tmp30        [V34    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V14._reference (fldOffset=0x0)" P-INDEP
    +;* V35 tmp31        [V35    ] (  0,  0   )     int  ->  zero-ref    "field V14._length (fldOffset=0x8)" P-INDEP
    +;* V36 tmp32        [V36    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V15._reference (fldOffset=0x0)" P-INDEP
    +;* V37 tmp33        [V37    ] (  0,  0   )     int  ->  zero-ref    "field V15._length (fldOffset=0x8)" P-INDEP
    +;* V38 tmp34        [V38    ] (  0,  0   )   byref  ->  zero-ref    "field V18._reference (fldOffset=0x0)" P-INDEP
    +;* V39 tmp35        [V39    ] (  0,  0   )     int  ->  zero-ref    "field V18._length (fldOffset=0x8)" P-INDEP
    +;* V40 tmp36        [V40    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V19._reference (fldOffset=0x0)" P-INDEP
    +;* V41 tmp37        [V41    ] (  0,  0   )     int  ->  zero-ref    "field V19._length (fldOffset=0x8)" P-INDEP
    +;* V42 tmp38        [V42    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V20._reference (fldOffset=0x0)" P-INDEP
    +;* V43 tmp39        [V43    ] (  0,  0   )     int  ->  zero-ref    "field V20._length (fldOffset=0x8)" P-INDEP
    +;* V44 tmp40        [V44    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V21._reference (fldOffset=0x0)" P-INDEP
    +;* V45 tmp41        [V45    ] (  0,  0   )     int  ->  zero-ref    "field V21._length (fldOffset=0x8)" P-INDEP
    +;* V46 tmp42        [V46    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V24._reference (fldOffset=0x0)" P-INDEP
    +;* V47 tmp43        [V47    ] (  0,  0   )     int  ->  zero-ref    "field V24._length (fldOffset=0x8)" P-INDEP
    +;* V48 tmp44        [V48    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V25._reference (fldOffset=0x0)" P-INDEP
    +;* V49 tmp45        [V49    ] (  0,  0   )     int  ->  zero-ref    "field V25._length (fldOffset=0x8)" P-INDEP
    +;  V50 tmp46        [V50,T12] (  2,  0   )     ref  ->  rsi         single-def "argument with side effect"
    +;  V51 tmp47        [V51,T13] (  2,  0   )     ref  ->  rdx         single-def "argument with side effect"
    +;  V52 cse0         [V52,T03] (  5,  4   )     int  ->  rbx         "CSE #01: aggressive"
     ;
     ; Lcl frame size = 8
     
     G_M5768_IG01:
            push     rbp
            push     r15
            push     r14
            push     rbx
            push     rax
            lea      rbp, [rsp+0x20]
    -       xor      eax, eax
    -       mov      qword ptr [rbp-0x20], rax
    -       mov      rbx, rdi
    -						;; size=21 bbWeight=1 PerfScore 7.00
    +						;; size=12 bbWeight=1 PerfScore 5.50
     G_M5768_IG02:
            test     rsi, rsi
            je       SHORT G_M5768_IG04
            test     edx, edx
    -       jl       G_M5768_IG05
    -       mov      r15d, dword ptr [rsi+0x08]
    -       cmp      r15d, edx
    -       jl       G_M5768_IG06
    -       mov      edi, r15d
    -       sub      edi, edx
    -       cmp      edi, 16
    +       jl       SHORT G_M5768_IG05
    +       mov      ebx, dword ptr [rsi+0x08]
    +       cmp      ebx, edx
    +       jl       SHORT G_M5768_IG06
    +       mov      eax, ebx
    +       sub      eax, edx
    +       cmp      eax, 16
            jl       G_M5768_IG07
    -       cmp      edx, r15d
    -       jae      G_M5768_IG08
    -       mov      edi, edx
    -       lea      rdi, bword ptr [rsi+rdi+0x10]
    -       mov      bword ptr [rbp-0x20], rdi
    -       mov      r15, bword ptr [rbp-0x20]
    -       mov      rdi, rbx
    -       mov      rsi, r15
    -       mov      rax, 0xD1FFAB1E      ; code for System.Xml.UniqueId:UnsafeGetInt64(ptr):long:this
    -       call     [rax]System.Xml.UniqueId:UnsafeGetInt64(ptr):long:this
    -       mov      qword ptr [rbx+0x10], rax
    -       lea      rsi, [r15+0x08]
    -       mov      rdi, rbx
    -       mov      rax, 0xD1FFAB1E      ; code for System.Xml.UniqueId:UnsafeGetInt64(ptr):long:this
    -       call     [rax]System.Xml.UniqueId:UnsafeGetInt64(ptr):long:this
    -       mov      qword ptr [rbx+0x18], rax
    -       xor      edi, edi
    -       mov      bword ptr [rbp-0x20], rdi
    -						;; size=115 bbWeight=1 PerfScore 23.00
    +       mov      eax, ebx
    +       mov      ecx, edx
    +       add      rcx, 16
    +       cmp      rax, rcx
    +       jb       G_M5768_IG08
    +       mov      eax, edx
    +       lea      rax, bword ptr [rsi+rax+0x10]
    +       mov      rcx, qword ptr [rax]
    +       mov      qword ptr [rdi+0x10], rcx
    +       add      rax, 8
    +       mov      rax, qword ptr [rax]
    +       mov      qword ptr [rdi+0x18], rax
    +						;; size=71 bbWeight=1 PerfScore 17.00
     G_M5768_IG03:
            add      rsp, 8
            pop      rbx
            pop      r14
            pop      r15
            pop      rbp
            ret      
     						;; size=11 bbWeight=1 PerfScore 3.25
     G_M5768_IG04:
            mov      rdi, 0xD1FFAB1E      ; 'guid'
            mov      rax, 0xD1FFAB1E      ; code for System.ArgumentNullException:Throw(System.String)
            call     [rax]System.ArgumentNullException:Throw(System.String)
            int3     
     						;; size=23 bbWeight=0 PerfScore 0.00
     G_M5768_IG05:
            mov      edi, edx
            mov      rsi, 0xD1FFAB1E      ; 'offset'
            mov      rax, 0xD1FFAB1E      ; code for System.ArgumentOutOfRangeException:ThrowNegative[int](int,System.String)
            call     [rax]System.ArgumentOutOfRangeException:ThrowNegative[int](int,System.String)
            int3     
     						;; size=25 bbWeight=0 PerfScore 0.00
     G_M5768_IG06:
            mov      rdi, 0xD1FFAB1E      ; System.Int32
            call     CORINFO_HELP_NEWSFAST
    -       mov      rbx, rax
    +       mov      r15, rax
            mov      rax, 0xD1FFAB1E      ; code for System.SR:get_OffsetExceedsBufferSize():System.String
            call     [rax]System.SR:get_OffsetExceedsBufferSize():System.String
            mov      r14, rax
    -       mov      dword ptr [rbx+0x08], r15d
    +       mov      dword ptr [r15+0x08], ebx
            mov      rdi, 0xD1FFAB1E      ; System.ArgumentOutOfRangeException
            call     CORINFO_HELP_NEWSFAST
    -       mov      r15, rax
    -       mov      rsi, rbx
    +       mov      rbx, rax
    +       mov      rsi, r15
            mov      rdi, r14
            mov      rax, 0xD1FFAB1E      ; code for System.SR:Format(System.String,System.Object):System.String
            call     [rax]System.SR:Format(System.String,System.Object):System.String
            mov      rdx, rax
    -       mov      rdi, r15
    +       mov      rdi, rbx
            mov      rsi, 0xD1FFAB1E      ; 'offset'
            mov      rax, 0xD1FFAB1E      ; code for System.ArgumentOutOfRangeException:.ctor(System.String,System.String):this
            call     [rax]System.ArgumentOutOfRangeException:.ctor(System.String,System.String):this
    -       mov      rdi, r15
    +       mov      rdi, rbx
            call     CORINFO_HELP_THROW
            int3     
     						;; size=110 bbWeight=0 PerfScore 0.00
     G_M5768_IG07:
            mov      rdi, 0xD1FFAB1E      ; System.Int32
            call     CORINFO_HELP_NEWSFAST
            mov      rbx, rax
            mov      rax, 0xD1FFAB1E      ; code for System.SR:get_XmlArrayTooSmallInput():System.String
            call     [rax]System.SR:get_XmlArrayTooSmallInput():System.String
            mov      r15, rax
            mov      dword ptr [rbx+0x08], 16
            mov      rdi, 0xD1FFAB1E      ; System.ArgumentException
            call     CORINFO_HELP_NEWSFAST
            mov      r14, rax
            mov      rsi, rbx
            mov      rdi, r15
            mov      rax, 0xD1FFAB1E      ; code for System.SR:Format(System.String,System.Object):System.String
            call     [rax]System.SR:Format(System.String,System.Object):System.String
            mov      rsi, rax
            mov      rdi, r14
            mov      rdx, 0xD1FFAB1E      ; 'guid'
            mov      rax, 0xD1FFAB1E      ; code for System.ArgumentException:.ctor(System.String,System.String):this
            call     [rax]System.ArgumentException:.ctor(System.String,System.String):this
            mov      rdi, r14
            call     CORINFO_HELP_THROW
            int3     
     						;; size=113 bbWeight=0 PerfScore 0.00
     G_M5768_IG08:
    -       call     CORINFO_HELP_RNGCHKFAIL
    +       mov      rax, 0xD1FFAB1E      ; code for System.ThrowHelper:ThrowArgumentOutOfRangeException()
    +       call     [rax]System.ThrowHelper:ThrowArgumentOutOfRangeException()
            int3     
    -						;; size=6 bbWeight=0 PerfScore 0.00
    +						;; size=13 bbWeight=0 PerfScore 0.00
     
    -; Total bytes of code 424, prolog size 18, PerfScore 33.25, instruction count 99, allocated bytes for code 424 (MethodHash=fd44e977) for method System.Xml.UniqueId:.ctor(byte[],int):this (FullOpts)
    +; Total bytes of code 378, prolog size 12, PerfScore 25.75, instruction count 91, allocated bytes for code 378 (MethodHash=fd44e977) for method System.Xml.UniqueId:.ctor(byte[],int):this (FullOpts)
     ; ============================================================
  2. MihuBot commented on Apr 29, 2026

    @MihuBot
    OwnerAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions