Skip to content

[JitDiff X64] [EgorBo] Remove unsafe pointer walk from OptimizedInboxTextEnc ... #2004

Open

Description

@MihuBot

Job completed in 2 minutes 26 seconds (remote runner delay: 0 seconds).
dotnet/runtime#129625

Main commit: dotnet/runtime@18696ad
PR commit: EgorBo/runtime-1@323962c

Diffs

Found 85 files with textual diffs.

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 45818653
Total bytes of diff: 45818698
Total bytes of delta: 45 (0.00 % of base)
Total relative delta: Infinity
    diff is a regression.
    relative diff is a regression.


Top file regressions (bytes):
          59 : System.Net.Sockets.dasm (0.02 % of base)

Top file improvements (bytes):
         -14 : System.Text.Encodings.Web.dasm (-0.06 % of base)

2 total files with Code Size differences (1 improved, 1 regressed), 258 unchanged.

Top method regressions (bytes):
          59 (Infinity of base) : System.Net.Sockets.dasm - System.Net.Sockets.SocketAsyncEngine+<>c:<.ctor>b__15_0(System.Object):this (FullOpts)

Top method improvements (bytes):
         -14 (-2.78 % of base) : System.Text.Encodings.Web.dasm - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[char]):int:this (FullOpts)

Top method regressions (percentages):
          59 (Infinity of base) : System.Net.Sockets.dasm - System.Net.Sockets.SocketAsyncEngine+<>c:<.ctor>b__15_0(System.Object):this (FullOpts)

Top method improvements (percentages):
         -14 (-2.78 % of base) : System.Text.Encodings.Web.dasm - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[char]):int:this (FullOpts)

2 total methods with Code Size differences (1 improved, 1 regressed), 288750 unchanged.

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

Artifacts:

Activity

  1. MihuBot commented on Jun 19, 2026

    @MihuBot
    OwnerAuthor

    Top method improvements

    -14 (-2.78 % of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[char]):int:this
     ; Assembly listing for method System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[char]):int:this (FullOpts)
     ; Emitting BLENDED_CODE for x64 + VEX + EVEX on Unix
     ; FullOpts code
     ; optimized code
     ; rbp based frame
     ; fully interruptible
     ; No PGO data
    -; 0 inlinees with PGO data; 11 single block inlinees; 11 inlinees without PGO data
    +; 0 inlinees with PGO data; 13 single block inlinees; 12 inlinees without PGO data
     ; Final local variable assignments
     ;
    -;  V00 this         [V00,T22] (  6, 11   )     ref  ->  rbx         this class-hnd single-def <System.Text.Encodings.Web.OptimizedInboxTextEncoder>
    +;  V00 this         [V00,T24] (  6, 10.96)     ref  ->  rbx         this class-hnd single-def <System.Text.Encodings.Web.OptimizedInboxTextEncoder>
     ;* V01 arg1         [V01    ] (  0,  0   )  struct (16) zero-ref    multireg-arg ld-addr-op single-def <System.ReadOnlySpan`1[char]>
    -;  V02 loc0         [V02,T27] (  6,  3.50)     int  ->  rax        
    -;  V03 loc1         [V03,T02] ( 10, 36.50)    long  ->  rdi        
    -;  V04 loc2         [V04    ] (  1,  0.50)   byref  ->  [rbp-0x20]  do-not-enreg[] must-init pinned single-def
    -;  V05 loc3         [V05,T23] (  6,  9.75)    long  ->  rcx        
    -;  V06 loc4         [V06,T00] ( 21, 62.75)    long  ->  rax        
    -;  V07 loc5         [V07,T28] (  5,  2.50)     int  ->  rax        
    -;  V08 loc6         [V08,T03] (  9, 32.50)    long  ->  rdx        
    -;# V09 OutArgs      [V09    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace" <Empty>
    -;* V10 tmp1         [V10    ] (  0,  0   )    long  ->  zero-ref    "dup spill"
    -;* V11 tmp2         [V11    ] (  0,  0   )    long  ->  zero-ref    "dup spill"
    -;* V12 tmp3         [V12    ] (  0,  0   )    long  ->  zero-ref    "dup spill"
    -;* V13 tmp4         [V13    ] (  0,  0   )    long  ->  zero-ref    "dup spill"
    -;* V14 tmp5         [V14    ] (  0,  0   )    long  ->  zero-ref    "dup spill"
    -;* V15 tmp6         [V15    ] (  0,  0   )    long  ->  zero-ref    "dup spill"
    -;* V16 tmp7         [V16    ] (  0,  0   )    long  ->  zero-ref    "dup spill"
    -;* V17 tmp8         [V17    ] (  0,  0   )    long  ->  zero-ref    "dup spill"
    -;  V18 tmp9         [V18,T26] (  4,  4   )     ref  ->  rdi         class-hnd single-def "Inlining Arg" <System.Buffers.SearchValues`1[char]>
    -;* V19 tmp10        [V19    ] (  0,  0   )  struct (16) zero-ref    "Inlining Arg" <System.ReadOnlySpan`1[char]>
    -;* V20 tmp11        [V20    ] (  0,  0   )  ushort  ->  zero-ref    "Inlining Arg"
    -;* V21 tmp12        [V21    ] (  0,  0   )   byref  ->  zero-ref    "Inline return value spill temp"
    -;  V22 tmp13        [V22,T30] (  3,  1.50)   byref  ->  rdi         "Inline stloc first use temp"
    -;* V23 tmp14        [V23    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    -;  V24 tmp15        [V24,T04] (  3, 24   )  ushort  ->   r9         "Inlining Arg"
    -;* V25 tmp16        [V25    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;* V26 tmp17        [V26    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;  V27 tmp18        [V27,T13] (  2, 16   )   byref  ->   r8         "Inlining Arg"
    -;* V28 tmp19        [V28    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    -;  V29 tmp20        [V29,T05] (  3, 24   )  ushort  ->   r9         "Inlining Arg"
    -;* V30 tmp21        [V30    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;* V31 tmp22        [V31    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;  V32 tmp23        [V32,T14] (  2, 16   )   byref  ->   r8         "Inlining Arg"
    -;* V33 tmp24        [V33    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    -;  V34 tmp25        [V34,T06] (  3, 24   )  ushort  ->   r9         "Inlining Arg"
    -;* V35 tmp26        [V35    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;* V36 tmp27        [V36    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;  V37 tmp28        [V37,T15] (  2, 16   )   byref  ->   r8         "Inlining Arg"
    -;* V38 tmp29        [V38    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    -;  V39 tmp30        [V39,T07] (  3, 24   )  ushort  ->   r9         "Inlining Arg"
    -;* V40 tmp31        [V40    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;* V41 tmp32        [V41    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;  V42 tmp33        [V42,T16] (  2, 16   )   byref  ->   r8         "Inlining Arg"
    -;* V43 tmp34        [V43    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    -;  V44 tmp35        [V44,T08] (  3, 24   )  ushort  ->   r9         "Inlining Arg"
    -;* V45 tmp36        [V45    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;* V46 tmp37        [V46    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;  V47 tmp38        [V47,T17] (  2, 16   )   byref  ->   r8         "Inlining Arg"
    -;* V48 tmp39        [V48    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    -;  V49 tmp40        [V49,T09] (  3, 24   )  ushort  ->   r9         "Inlining Arg"
    -;* V50 tmp41        [V50    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;* V51 tmp42        [V51    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;  V52 tmp43        [V52,T18] (  2, 16   )   byref  ->   r8         "Inlining Arg"
    -;* V53 tmp44        [V53    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    -;  V54 tmp45        [V54,T10] (  3, 24   )  ushort  ->   r9         "Inlining Arg"
    -;* V55 tmp46        [V55    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;* V56 tmp47        [V56    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;  V57 tmp48        [V57,T19] (  2, 16   )   byref  ->   r8         "Inlining Arg"
    -;* V58 tmp49        [V58    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    -;  V59 tmp50        [V59,T11] (  3, 24   )  ushort  ->   r8         "Inlining Arg"
    -;* V60 tmp51        [V60    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;* V61 tmp52        [V61    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;  V62 tmp53        [V62,T20] (  2, 16   )   byref  ->  rsi         "Inlining Arg"
    -;* V63 tmp54        [V63    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    -;  V64 tmp55        [V64,T12] (  3, 24   )  ushort  ->  rsi         "Inlining Arg"
    -;* V65 tmp56        [V65    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;* V66 tmp57        [V66    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    -;  V67 tmp58        [V67,T21] (  2, 16   )   byref  ->  rdx         "Inlining Arg"
    -;  V68 tmp59        [V68,T25] (  4,  2.50)   byref  ->  r14         single-def "field V01._reference (fldOffset=0x0)" P-INDEP
    -;  V69 tmp60        [V69,T24] (  6,  4   )     int  ->  r15         single-def "field V01._length (fldOffset=0x8)" P-INDEP
    -;* V70 tmp61        [V70    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V19._reference (fldOffset=0x0)" P-INDEP
    -;* V71 tmp62        [V71    ] (  0,  0   )     int  ->  zero-ref    "field V19._length (fldOffset=0x8)" P-INDEP
    -;  V72 tmp63        [V72,T29] (  2,  2   )    long  ->  rdi         "Cast away GC"
    -;  V73 cse0         [V73,T01] ( 11, 44   )   byref  ->  rsi         multi-def "CSE #01: aggressive"
    +;  V02 loc0         [V02,T30] (  6,  3.50)     int  ->  rax        
    +;  V03 loc1         [V03,T02] ( 24, 25.92)     int  ->  rax        
    +;* V04 loc2         [V04    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.ReadOnlySpan`1[char]>
    +;* V05 loc3         [V05,T33] (  0,  0   )     int  ->  zero-ref   
    +;# V06 OutArgs      [V06    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace" <Empty>
    +;  V07 tmp1         [V07,T29] (  4,  4   )     ref  ->  rdi         class-hnd single-def "Inlining Arg" <System.Buffers.SearchValues`1[char]>
    +;* V08 tmp2         [V08    ] (  0,  0   )  struct (16) zero-ref    "Inlining Arg" <System.ReadOnlySpan`1[char]>
    +;* V09 tmp3         [V09    ] (  0,  0   )  ushort  ->  zero-ref    "Inlining Arg"
    +;* V10 tmp4         [V10    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[char]>
    +;  V11 tmp5         [V11,T31] (  2,  2   )   byref  ->  rdi         single-def "Inlining Arg"
    +;  V12 tmp6         [V12,T32] (  2,  2   )     int  ->  rcx         "Inlining Arg"
    +;* V13 tmp7         [V13    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    +;  V14 tmp8         [V14,T03] (  3, 24   )  ushort  ->   r8         "Inlining Arg"
    +;* V15 tmp9         [V15    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;* V16 tmp10        [V16    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;  V17 tmp11        [V17,T12] (  2, 16   )   byref  ->  rsi         "Inlining Arg"
    +;* V18 tmp12        [V18    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    +;  V19 tmp13        [V19,T04] (  3, 24   )  ushort  ->   r8         "Inlining Arg"
    +;* V20 tmp14        [V20    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;* V21 tmp15        [V21    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;  V22 tmp16        [V22,T13] (  2, 16   )   byref  ->  rsi         "Inlining Arg"
    +;* V23 tmp17        [V23    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    +;  V24 tmp18        [V24,T05] (  3, 24   )  ushort  ->   r8         "Inlining Arg"
    +;* V25 tmp19        [V25    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;* V26 tmp20        [V26    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;  V27 tmp21        [V27,T14] (  2, 16   )   byref  ->  rsi         "Inlining Arg"
    +;* V28 tmp22        [V28    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    +;  V29 tmp23        [V29,T06] (  3, 24   )  ushort  ->   r8         "Inlining Arg"
    +;* V30 tmp24        [V30    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;* V31 tmp25        [V31    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;  V32 tmp26        [V32,T15] (  2, 16   )   byref  ->  rsi         "Inlining Arg"
    +;* V33 tmp27        [V33    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    +;  V34 tmp28        [V34,T07] (  3, 24   )  ushort  ->   r8         "Inlining Arg"
    +;* V35 tmp29        [V35    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;* V36 tmp30        [V36    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;  V37 tmp31        [V37,T16] (  2, 16   )   byref  ->  rsi         "Inlining Arg"
    +;* V38 tmp32        [V38    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    +;  V39 tmp33        [V39,T08] (  3, 24   )  ushort  ->   r8         "Inlining Arg"
    +;* V40 tmp34        [V40    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;* V41 tmp35        [V41    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;  V42 tmp36        [V42,T17] (  2, 16   )   byref  ->  rsi         "Inlining Arg"
    +;* V43 tmp37        [V43    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    +;  V44 tmp38        [V44,T09] (  3, 24   )  ushort  ->   r8         "Inlining Arg"
    +;* V45 tmp39        [V45    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;* V46 tmp40        [V46    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;  V47 tmp41        [V47,T18] (  2, 16   )   byref  ->  rsi         "Inlining Arg"
    +;* V48 tmp42        [V48    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    +;  V49 tmp43        [V49,T10] (  3, 24   )  ushort  ->  rsi         "Inlining Arg"
    +;* V50 tmp44        [V50    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;* V51 tmp45        [V51    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;  V52 tmp46        [V52,T19] (  2, 16   )   byref  ->  rdx         "Inlining Arg"
    +;* V53 tmp47        [V53    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[char]>
    +;  V54 tmp48        [V54,T20] (  2, 16   )   byref  ->  rdi         "Inlining Arg"
    +;  V55 tmp49        [V55,T21] (  2, 16   )     int  ->  rcx         "Inlining Arg"
    +;* V56 tmp50        [V56    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
    +;  V57 tmp51        [V57,T11] (  3, 23.76)  ushort  ->   r8         "Inlining Arg"
    +;* V58 tmp52        [V58    ] (  0,  0   )    long  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;* V59 tmp53        [V59    ] (  0,  0   )     int  ->  zero-ref    ld-addr-op "Inline ldloca(s) first use temp"
    +;  V60 tmp54        [V60,T22] (  2, 15.84)   byref  ->  rsi         "Inlining Arg"
    +;  V61 tmp55        [V61,T28] (  4,  2.50)   byref  ->  r14         single-def "field V01._reference (fldOffset=0x0)" P-INDEP
    +;  V62 tmp56        [V62,T27] (  7,  4.50)     int  ->  r15         single-def "field V01._length (fldOffset=0x8)" P-INDEP
    +;  V63 tmp57        [V63,T00] ( 12, 44.46)   byref  ->  rdi         "field V04._reference (fldOffset=0x0)" P-INDEP
    +;  V64 tmp58        [V64,T23] (  7, 14   )     int  ->  rcx         "field V04._length (fldOffset=0x8)" P-INDEP
    +;* V65 tmp59        [V65    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V08._reference (fldOffset=0x0)" P-INDEP
    +;* V66 tmp60        [V66    ] (  0,  0   )     int  ->  zero-ref    "field V08._length (fldOffset=0x8)" P-INDEP
    +;* V67 tmp61        [V67    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V10._reference (fldOffset=0x0)" P-INDEP
    +;* V68 tmp62        [V68    ] (  0,  0   )     int  ->  zero-ref    "field V10._length (fldOffset=0x8)" P-INDEP
    +;* V69 tmp63        [V69    ] (  0,  0   )   byref  ->  zero-ref    "field V53._reference (fldOffset=0x0)" P-INDEP
    +;* V70 tmp64        [V70    ] (  0,  0   )     int  ->  zero-ref    "field V53._length (fldOffset=0x8)" P-INDEP
    +;  V71 cse0         [V71,T01] ( 11, 43.92)   byref  ->  registers   multi-def "CSE #01: aggressive"
    +;  V72 rat0         [V72,T25] (  4, 12.38)    long  ->  rdx         "Strength reduced derived IV"
    +;  V73 rat1         [V73,T26] (  4, 12.38)     int  ->  rcx         "Trip count IV"
     ;
     ; Lcl frame size = 8
     
     G_M4922_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
            mov      r14, rsi
            mov      r15d, edx
    -						;; size=27 bbWeight=1 PerfScore 7.50
    +						;; size=21 bbWeight=1 PerfScore 6.25
     G_M4922_IG02:
            xor      eax, eax
            cmp      r15d, 8
            jl       SHORT G_M4922_IG04
     						;; size=8 bbWeight=1 PerfScore 1.50
     G_M4922_IG03:
            mov      rdi, gword ptr [rbx+0x18]
            test     rdi, rdi
    -       je       G_M4922_IG14
    +       je       G_M4922_IG19
            mov      rsi, r14
            mov      edx, r15d
            mov      rax, qword ptr [rdi]
            mov      rax, qword ptr [rax+0x40]
            call     [rax+0x38]System.Buffers.SearchValues`1[char]:IndexOfAnyExcept(System.ReadOnlySpan`1[char]):int:this
            cmp      eax, r15d
    -       jae      G_M4922_IG13
    +       jae      G_M4922_IG18
            mov      edi, eax
            cmp      word  ptr [r14+2*rdi], 127
    -       jbe      G_M4922_IG13
    +       jbe      G_M4922_IG18
     						;; size=52 bbWeight=0.50 PerfScore 7.62
     G_M4922_IG04:
    -       xor      rdi, rdi
    -       test     r15d, r15d
    -       cmovne   rdi, r14
    -       mov      bword ptr [rbp-0x20], rdi
    -       mov      ecx, r15d
    -       mov      eax, eax
    -       cmp      rax, rcx
    -       jae      G_M4922_IG11
    +       cmp      eax, r15d
    +       jae      G_M4922_IG09
            cmp      byte  ptr [rbx], bl
    -       jmp      SHORT G_M4922_IG06
    +       mov      edi, eax
    +       lea      rdi, bword ptr [r14+2*rdi]
    +       mov      ecx, r15d
    +       sub      ecx, eax
    +       cmp      ecx, 8
    +       jl       G_M4922_IG07
            align    [0 bytes for IG05]
    -						;; size=31 bbWeight=0.50 PerfScore 3.88
    +						;; size=31 bbWeight=0.50 PerfScore 2.88
     G_M4922_IG05:
    -       add      rax, 8
    -						;; size=4 bbWeight=4 PerfScore 1.00
    -G_M4922_IG06:
    -       mov      rdx, rcx
    -       sub      rdx, rax
    -       cmp      rdx, 8
    -       jb       G_M4922_IG09
    -       xor      edx, edx
    -       lea      rsi, bword ptr [rbx+0x0420]
    -       mov      r8, rsi
    -       movzx    r9, word  ptr [rdi+2*rax]
    -       mov      r10d, r9d
    -       shr      r10d, 5
    -       mov      r8d, dword ptr [r8+4*r10]
    -       bt       r8d, r9d
    -       jae      G_M4922_IG08
    -       mov      edx, 1
    -       mov      r8, rsi
    -       movzx    r9, word  ptr [rdi+2*rax+0x02]
    -       mov      r10d, r9d
    -       shr      r10d, 5
    -       mov      r8d, dword ptr [r8+4*r10]
    -       bt       r8d, r9d
    -       jae      G_M4922_IG08
    -       mov      edx, 2
    -       mov      r8, rsi
    -       movzx    r9, word  ptr [rdi+2*rax+0x04]
    -       mov      r10d, r9d
    -       shr      r10d, 5
    -       mov      r8d, dword ptr [r8+4*r10]
    -       bt       r8d, r9d
    -       jae      G_M4922_IG08
    -       mov      edx, 3
    -       mov      r8, rsi
    -       movzx    r9, word  ptr [rdi+2*rax+0x06]
    -       mov      r10d, r9d
    -       shr      r10d, 5
    -       mov      r8d, dword ptr [r8+4*r10]
    -       bt       r8d, r9d
    -       jae      G_M4922_IG08
    -       mov      edx, 4
    -       mov      r8, rsi
    -       movzx    r9, word  ptr [rdi+2*rax+0x08]
    -       mov      r10d, r9d
    -       shr      r10d, 5
    -       mov      r8d, dword ptr [r8+4*r10]
    -       bt       r8d, r9d
    -       jae      SHORT G_M4922_IG08
    -       mov      edx, 5
    -       mov      r8, rsi
    -       movzx    r9, word  ptr [rdi+2*rax+0x0A]
    -       mov      r10d, r9d
    -       shr      r10d, 5
    -       mov      r8d, dword ptr [r8+4*r10]
    -       bt       r8d, r9d
    -       jae      SHORT G_M4922_IG08
    -       mov      edx, 6
    -       mov      r8, rsi
    -       movzx    r9, word  ptr [rdi+2*rax+0x0C]
    -       mov      r10d, r9d
    -       shr      r10d, 5
    -       mov      r8d, dword ptr [r8+4*r10]
    -       bt       r8d, r9d
    -       jae      SHORT G_M4922_IG08
    -						;; size=252 bbWeight=4 PerfScore 198.00
    -G_M4922_IG07:
    -       mov      edx, 7
    -       movzx    r8, word  ptr [rdi+2*rax+0x0E]
    +       lea      rdx, bword ptr [rbx+0x0420]
    +       mov      rsi, rdx
    +       movzx    r8, word  ptr [rdi]
            mov      r9d, r8d
            shr      r9d, 5
            mov      esi, dword ptr [rsi+4*r9]
            bt       esi, r8d
    -       jb       G_M4922_IG05
    -						;; size=32 bbWeight=4 PerfScore 26.00
    -G_M4922_IG08:
    -       add      rax, rdx
    -       jmp      SHORT G_M4922_IG11
    -       align    [0 bytes for IG10]
    -						;; size=5 bbWeight=0.50 PerfScore 1.12
    -G_M4922_IG09:
    -       cmp      rax, rcx
    -       jae      SHORT G_M4922_IG11
    -						;; size=5 bbWeight=0.25 PerfScore 0.31
    -G_M4922_IG10:
    -       lea      rsi, bword ptr [rbx+0x0420]
    -       mov      rdx, rsi
    -       movzx    rsi, word  ptr [rdi+2*rax]
    +       jae      G_M4922_IG09
    +       mov      rsi, rdx
    +       movzx    r8, word  ptr [rdi+0x02]
    +       mov      r9d, r8d
    +       shr      r9d, 5
    +       mov      esi, dword ptr [rsi+4*r9]
    +       bt       esi, r8d
    +       jae      G_M4922_IG11
    +       mov      rsi, rdx
    +       movzx    r8, word  ptr [rdi+0x04]
    +       mov      r9d, r8d
    +       shr      r9d, 5
    +       mov      esi, dword ptr [rsi+4*r9]
    +       bt       esi, r8d
    +       jae      G_M4922_IG12
    +       mov      rsi, rdx
    +       movzx    r8, word  ptr [rdi+0x06]
    +       mov      r9d, r8d
    +       shr      r9d, 5
    +       mov      esi, dword ptr [rsi+4*r9]
    +       bt       esi, r8d
    +       jae      G_M4922_IG13
    +       mov      rsi, rdx
    +       movzx    r8, word  ptr [rdi+0x08]
    +       mov      r9d, r8d
    +       shr      r9d, 5
    +       mov      esi, dword ptr [rsi+4*r9]
    +       bt       esi, r8d
    +       jae      G_M4922_IG14
    +       mov      rsi, rdx
    +       movzx    r8, word  ptr [rdi+0x0A]
    +       mov      r9d, r8d
    +       shr      r9d, 5
    +       mov      esi, dword ptr [rsi+4*r9]
    +       bt       esi, r8d
    +       jae      G_M4922_IG15
    +       mov      rsi, rdx
    +       movzx    r8, word  ptr [rdi+0x0C]
    +       mov      r9d, r8d
    +       shr      r9d, 5
    +       mov      esi, dword ptr [rsi+4*r9]
    +       bt       esi, r8d
    +       jae      G_M4922_IG16
    +       movzx    rsi, word  ptr [rdi+0x0E]
            mov      r8d, esi
            shr      r8d, 5
            mov      edx, dword ptr [rdx+4*r8]
            bt       edx, esi
    -       jae      SHORT G_M4922_IG11
    -       inc      rax
    -       cmp      rax, rcx
    -       jb       SHORT G_M4922_IG10
    -						;; size=38 bbWeight=4 PerfScore 34.00
    -G_M4922_IG11:
    +       jae      SHORT G_M4922_IG17
    +       add      eax, 8
    +       add      rdi, 16
    +       add      ecx, -8
    +						;; size=239 bbWeight=4 PerfScore 212.00
    +G_M4922_IG06:
    +       cmp      ecx, 8
    +       jge      G_M4922_IG05
    +						;; size=9 bbWeight=4 PerfScore 5.00
    +G_M4922_IG07:
    +       test     ecx, ecx
    +       je       SHORT G_M4922_IG09
    +       xor      edx, edx
    +       align    [0 bytes for IG08]
    +						;; size=6 bbWeight=0.50 PerfScore 0.75
    +G_M4922_IG08:
    +       lea      rsi, bword ptr [rbx+0x0420]
    +       movzx    r8, word  ptr [rdi+rdx]
    +       mov      r9d, r8d
    +       shr      r9d, 5
    +       mov      esi, dword ptr [rsi+4*r9]
    +       bt       esi, r8d
    +       jae      SHORT G_M4922_IG09
    +       inc      eax
    +       add      rdx, 2
    +       dec      ecx
    +       jne      SHORT G_M4922_IG08
    +						;; size=39 bbWeight=3.96 PerfScore 33.66
    +G_M4922_IG09:
            mov      edi, -1
    -       cmp      eax, ecx
    +       cmp      eax, r15d
            cmove    eax, edi
    -						;; size=10 bbWeight=0.50 PerfScore 0.50
    +						;; size=11 bbWeight=0.50 PerfScore 0.50
    +G_M4922_IG10:
    +       add      rsp, 8
    +       pop      rbx
    +       pop      r14
    +       pop      r15
    +       pop      rbp
    +       ret      
    +						;; size=11 bbWeight=0.50 PerfScore 1.62
    +G_M4922_IG11:
    +       inc      eax
    +       jmp      SHORT G_M4922_IG09
    +						;; size=4 bbWeight=0.50 PerfScore 1.12
     G_M4922_IG12:
    -       add      rsp, 8
    -       pop      rbx
    -       pop      r14
    -       pop      r15
    -       pop      rbp
    -       ret      
    -						;; size=11 bbWeight=0.50 PerfScore 1.62
    +       add      eax, 2
    +       jmp      SHORT G_M4922_IG09
    +						;; size=5 bbWeight=0.50 PerfScore 1.12
     G_M4922_IG13:
    +       add      eax, 3
    +       jmp      SHORT G_M4922_IG09
    +						;; size=5 bbWeight=0.50 PerfScore 1.12
    +G_M4922_IG14:
    +       add      eax, 4
    +       jmp      SHORT G_M4922_IG09
    +						;; size=5 bbWeight=0.50 PerfScore 1.12
    +G_M4922_IG15:
    +       add      eax, 5
    +       jmp      SHORT G_M4922_IG09
    +						;; size=5 bbWeight=0.50 PerfScore 1.12
    +G_M4922_IG16:
    +       add      eax, 6
    +       jmp      SHORT G_M4922_IG09
    +						;; size=5 bbWeight=0.50 PerfScore 1.12
    +G_M4922_IG17:
    +       add      eax, 7
    +       jmp      SHORT G_M4922_IG09
    +						;; size=5 bbWeight=0.50 PerfScore 1.12
    +G_M4922_IG18:
            add      rsp, 8
            pop      rbx
            pop      r14
            pop      r15
            pop      rbp
            ret      
     						;; size=11 bbWeight=0.50 PerfScore 1.62
    -G_M4922_IG14:
    +G_M4922_IG19:
            mov      edi, 6
            mov      rax, 0xD1FFAB1E      ; code for System.ThrowHelper:ThrowArgumentNullException(int)
            call     [rax]System.ThrowHelper:ThrowArgumentNullException(int)
            int3     
     						;; size=18 bbWeight=0 PerfScore 0.00
     
    -; Total bytes of code 504, prolog size 27, PerfScore 284.69, instruction count 142, allocated bytes for code 504 (MethodHash=4e14ecc5) for method System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[char]):int:this (FullOpts)
    +; Total bytes of code 490, prolog size 21, PerfScore 281.28, instruction count 144, allocated bytes for code 494 (MethodHash=4e14ecc5) for method System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[char]):int:this (FullOpts)
     ; ============================================================
  2. MihuBot commented on Jun 19, 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