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

[JitDiff X64] xtqqczze/dotnet-runtime/UIntCastLengthCheck2 #687

Open
MihuBot opened this issue Oct 5, 2024 · 3 comments
Open

[JitDiff X64] xtqqczze/dotnet-runtime/UIntCastLengthCheck2 #687

MihuBot opened this issue Oct 5, 2024 · 3 comments

Comments

@MihuBot
Copy link
Owner

MihuBot commented Oct 5, 2024

Job completed in 18 minutes 14 seconds.

Diffs

Found 266 files with textual diffs.

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 39447446
Total bytes of diff: 39447455
Total bytes of delta: 9 (0.00 % of base)
Total relative delta: 0.02
    diff is a regression.
    relative diff is a regression.


Top file regressions (bytes):
           9 : System.Private.Xml.dasm (0.00 % of base)

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

Top method regressions (bytes):
           9 (2.42 % of base) : System.Private.Xml.dasm - System.Xml.XmlSqlBinaryReader:CheckText(ubyte):int:this (FullOpts)

Top method regressions (percentages):
           9 (2.42 % of base) : System.Private.Xml.dasm - System.Xml.XmlSqlBinaryReader:CheckText(ubyte):int:this (FullOpts)

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

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

Artifacts:

@xtqqczze
Copy link

xtqqczze commented Oct 5, 2024

xtqqczze/dotnet-runtime@013187c
UIntCastLengthCheck

@MihuBot
Copy link
Owner Author

MihuBot commented Oct 5, 2024

Top method regressions

9 (2.42 % of base) - System.Xml.XmlSqlBinaryReader:CheckText(ubyte):int:this
 ; Assembly listing for method System.Xml.XmlSqlBinaryReader:CheckText(ubyte):int:this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 26 single block inlinees; 9 inlinees without PGO data
 ; Final local variable assignments
 ;
 ;  V00 this         [V00,T15] (  7,  5.50)     ref  ->  rbx         this class-hnd single-def <System.Xml.XmlSqlBinaryReader>
 ;  V01 arg1         [V01,T19] (  3,  3   )   ubyte  ->  rsi         single-def
 ;* V02 loc0         [V02    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.ReadOnlySpan`1[ubyte]>
 ;  V03 loc1         [V03,T09] (  3, 12   )  ushort  ->  rsi         ld-addr-op
 ;* V04 loc2         [V04    ] (  0,  0   )  ushort  ->  zero-ref   
 ;  V05 loc3         [V05,T08] (  5, 12   )  ushort  ->  rax         ld-addr-op
 ;  V06 loc4         [V06,T10] (  3,  8   )  ushort  ->  rsi         ld-addr-op
 ;# V07 OutArgs      [V07    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V08 tmp1         [V08    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.Span`1[ubyte]>
 ;  V09 tmp2         [V09,T16] (  4,  6   )     ref  ->  rdi         class-hnd single-def "Inlining Arg" <ubyte[]>
 ;  V10 tmp3         [V10,T17] (  4,  5   )     int  ->  rcx         "Inlining Arg"
 ;  V11 tmp4         [V11,T18] (  4,  5   )     int  ->   r8         "Inlining Arg"
 ;* V12 tmp5         [V12    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.Span`1[ubyte]>
 ;* V13 tmp6         [V13    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[ubyte]>
 ;* V14 tmp7         [V14    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[ubyte]>
 ;* V15 tmp8         [V15    ] (  0,  0   )   byref  ->  zero-ref    single-def "Inlining Arg"
 ;* V16 tmp9         [V16    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
 ;* V17 tmp10        [V17    ] (  0,  0   )  struct (16) zero-ref    "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V18 tmp11        [V18    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
 ;* V19 tmp12        [V19    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V20 tmp13        [V20    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V21 tmp14        [V21    ] (  0,  0   )  ushort  ->  zero-ref    "Inlining Arg"
 ;* V22 tmp15        [V22    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.ReadOnlySpan`1[ubyte]>
 ;* V23 tmp16        [V23    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[ubyte]>
 ;* V24 tmp17        [V24    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V25 tmp18        [V25    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[ubyte]>
 ;  V26 tmp19        [V26,T04] (  2, 16   )   byref  ->  rdi         "Inlining Arg"
 ;  V27 tmp20        [V27,T06] (  2, 16   )     int  ->   r8         "Inlining Arg"
 ;* V28 tmp21        [V28    ] (  0,  0   )  struct (16) zero-ref    "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V29 tmp22        [V29    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
 ;* V30 tmp23        [V30    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V31 tmp24        [V31    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V32 tmp25        [V32    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[ubyte]>
 ;  V33 tmp26        [V33,T02] (  2, 16   )   byref  ->  rdi         "Inlining Arg"
 ;  V34 tmp27        [V34,T03] (  2, 16   )     int  ->   r8         "Inlining Arg"
 ;* V35 tmp28        [V35    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.ReadOnlySpan`1[ubyte]>
 ;* V36 tmp29        [V36    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[ubyte]>
 ;* V37 tmp30        [V37    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V38 tmp31        [V38    ] (  0,  0   )  struct (16) zero-ref    "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V39 tmp32        [V39    ] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
 ;* V40 tmp33        [V40    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V41 tmp34        [V41    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[ubyte]>
 ;* V42 tmp35        [V42    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
 ;* V43 tmp36        [V43    ] (  0,  0   )  ushort  ->  zero-ref    "Inlining Arg"
 ;* V44 tmp37        [V44    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.ReadOnlySpan`1[ubyte]>
 ;  V45 tmp38        [V45,T05] (  2, 16   )   byref  ->  rdi         "Inlining Arg"
 ;  V46 tmp39        [V46,T07] (  2, 16   )     int  ->   r8         "Inlining Arg"
-;  V47 tmp40        [V47,T00] ( 10, 37   )   byref  ->  rdi         "field V02._reference (fldOffset=0x0)" P-INDEP
-;  V48 tmp41        [V48,T01] ( 10, 37   )     int  ->   r8         "field V02._length (fldOffset=0x8)" P-INDEP
+;  V47 tmp40        [V47,T01] ( 10, 37   )   byref  ->  rdi         "field V02._reference (fldOffset=0x0)" P-INDEP
+;  V48 tmp41        [V48,T00] ( 11, 41   )     int  ->   r8         "field V02._length (fldOffset=0x8)" P-INDEP
 ;* V49 tmp42        [V49    ] (  0,  0   )   byref  ->  zero-ref    "field V08._reference (fldOffset=0x0)" P-INDEP
 ;* V50 tmp43        [V50    ] (  0,  0   )     int  ->  zero-ref    "field V08._length (fldOffset=0x8)" P-INDEP
 ;  V51 tmp44        [V51,T23] (  3,  2   )   byref  ->  rdi         "field V12._reference (fldOffset=0x0)" P-INDEP
 ;  V52 tmp45        [V52,T24] (  3,  2   )     int  ->   r8         "field V12._length (fldOffset=0x8)" P-INDEP
 ;* V53 tmp46        [V53    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V13._reference (fldOffset=0x0)" P-INDEP
 ;* V54 tmp47        [V54    ] (  0,  0   )     int  ->  zero-ref    "field V13._length (fldOffset=0x8)" P-INDEP
 ;  V55 tmp48        [V55,T25] (  2,  2   )   byref  ->  rdi         single-def "field V14._reference (fldOffset=0x0)" P-INDEP
 ;  V56 tmp49        [V56,T26] (  2,  2   )     int  ->   r8         "field V14._length (fldOffset=0x8)" P-INDEP
 ;* V57 tmp50        [V57    ] (  0,  0   )   byref  ->  zero-ref    "field V17._reference (fldOffset=0x0)" P-INDEP
 ;* V58 tmp51        [V58    ] (  0,  0   )     int  ->  zero-ref    "field V17._length (fldOffset=0x8)" P-INDEP
 ;* V59 tmp52        [V59    ] (  0,  0   )   byref  ->  zero-ref    "field V19._reference (fldOffset=0x0)" P-INDEP
 ;* V60 tmp53        [V60    ] (  0,  0   )     int  ->  zero-ref    "field V19._length (fldOffset=0x8)" P-INDEP
 ;* V61 tmp54        [V61    ] (  0,  0   )   byref  ->  zero-ref    "field V20._reference (fldOffset=0x0)" P-INDEP
 ;* V62 tmp55        [V62    ] (  0,  0   )     int  ->  zero-ref    "field V20._length (fldOffset=0x8)" P-INDEP
 ;* V63 tmp56        [V63    ] (  0,  0   )   byref  ->  zero-ref    "field V22._reference (fldOffset=0x0)" P-INDEP
 ;* V64 tmp57        [V64    ] (  0,  0   )     int  ->  zero-ref    "field V22._length (fldOffset=0x8)" P-INDEP
 ;* V65 tmp58        [V65    ] (  0,  0   )   byref  ->  zero-ref    "field V23._reference (fldOffset=0x0)" P-INDEP
 ;* V66 tmp59        [V66    ] (  0,  0   )     int  ->  zero-ref    "field V23._length (fldOffset=0x8)" P-INDEP
 ;* V67 tmp60        [V67    ] (  0,  0   )   byref  ->  zero-ref    "field V24._reference (fldOffset=0x0)" P-INDEP
 ;* V68 tmp61        [V68    ] (  0,  0   )     int  ->  zero-ref    "field V24._length (fldOffset=0x8)" P-INDEP
 ;  V69 tmp62        [V69,T11] (  2,  8   )   byref  ->  rdi         "field V25._reference (fldOffset=0x0)" P-INDEP
 ;  V70 tmp63        [V70,T13] (  2,  8   )     int  ->   r8         "field V25._length (fldOffset=0x8)" P-INDEP
 ;* V71 tmp64        [V71    ] (  0,  0   )   byref  ->  zero-ref    "field V28._reference (fldOffset=0x0)" P-INDEP
 ;* V72 tmp65        [V72    ] (  0,  0   )     int  ->  zero-ref    "field V28._length (fldOffset=0x8)" P-INDEP
 ;* V73 tmp66        [V73    ] (  0,  0   )   byref  ->  zero-ref    "field V30._reference (fldOffset=0x0)" P-INDEP
 ;* V74 tmp67        [V74    ] (  0,  0   )     int  ->  zero-ref    "field V30._length (fldOffset=0x8)" P-INDEP
 ;* V75 tmp68        [V75    ] (  0,  0   )   byref  ->  zero-ref    "field V31._reference (fldOffset=0x0)" P-INDEP
 ;* V76 tmp69        [V76    ] (  0,  0   )     int  ->  zero-ref    "field V31._length (fldOffset=0x8)" P-INDEP
 ;* V77 tmp70        [V77,T20] (  0,  0   )   byref  ->  zero-ref    "field V32._reference (fldOffset=0x0)" P-INDEP
 ;* V78 tmp71        [V78,T21] (  0,  0   )     int  ->  zero-ref    "field V32._length (fldOffset=0x8)" P-INDEP
 ;* V79 tmp72        [V79    ] (  0,  0   )   byref  ->  zero-ref    "field V35._reference (fldOffset=0x0)" P-INDEP
 ;* V80 tmp73        [V80    ] (  0,  0   )     int  ->  zero-ref    "field V35._length (fldOffset=0x8)" P-INDEP
 ;* V81 tmp74        [V81    ] (  0,  0   )   byref  ->  zero-ref    "field V36._reference (fldOffset=0x0)" P-INDEP
 ;* V82 tmp75        [V82    ] (  0,  0   )     int  ->  zero-ref    "field V36._length (fldOffset=0x8)" P-INDEP
 ;* V83 tmp76        [V83    ] (  0,  0   )   byref  ->  zero-ref    "field V37._reference (fldOffset=0x0)" P-INDEP
 ;* V84 tmp77        [V84    ] (  0,  0   )     int  ->  zero-ref    "field V37._length (fldOffset=0x8)" P-INDEP
 ;* V85 tmp78        [V85    ] (  0,  0   )   byref  ->  zero-ref    "field V38._reference (fldOffset=0x0)" P-INDEP
 ;* V86 tmp79        [V86    ] (  0,  0   )     int  ->  zero-ref    "field V38._length (fldOffset=0x8)" P-INDEP
 ;* V87 tmp80        [V87    ] (  0,  0   )   byref  ->  zero-ref    "field V40._reference (fldOffset=0x0)" P-INDEP
 ;* V88 tmp81        [V88    ] (  0,  0   )     int  ->  zero-ref    "field V40._length (fldOffset=0x8)" P-INDEP
 ;* V89 tmp82        [V89    ] (  0,  0   )   byref  ->  zero-ref    "field V41._reference (fldOffset=0x0)" P-INDEP
 ;* V90 tmp83        [V90    ] (  0,  0   )     int  ->  zero-ref    "field V41._length (fldOffset=0x8)" P-INDEP
 ;  V91 tmp84        [V91,T12] (  2,  8   )   byref  ->  rdi         "field V44._reference (fldOffset=0x0)" P-INDEP
 ;  V92 tmp85        [V92,T14] (  2,  8   )     int  ->   r8         "field V44._length (fldOffset=0x8)" P-INDEP
 ;  V93 tmp86        [V93,T27] (  2,  0   )     ref  ->  rsi         "argument with side effect"
 ;  V94 cse0         [V94,T22] (  3,  3   )     int  ->  rdx         "CSE #01: conservative"
 ;
 ; Lcl frame size = 8
 
 G_M6289_IG01:
        push     rbp
        push     rbx
        push     rax
        lea      rbp, [rsp+0x10]
        mov      rbx, rdi
 						;; size=11 bbWeight=1 PerfScore 3.75
 G_M6289_IG02:
        mov      rdi, gword ptr [rbx+0x10]
        mov      edx, dword ptr [rbx+0xB4]
        mov      ecx, edx
        mov      r8d, dword ptr [rbx+0x80]
        sub      r8d, edx
        test     rdi, rdi
        je       SHORT G_M6289_IG04
 						;; size=27 bbWeight=1 PerfScore 7.75
 G_M6289_IG03:
        mov      edx, ecx
        mov      eax, r8d
        add      rdx, rax
        mov      eax, dword ptr [rdi+0x08]
        cmp      rdx, rax
        ja       G_M6289_IG17
        mov      ecx, ecx
        lea      rdi, bword ptr [rdi+rcx+0x10]
        jmp      SHORT G_M6289_IG05
        align    [0 bytes for IG06]
 						;; size=29 bbWeight=0.50 PerfScore 3.62
 G_M6289_IG04:
        or       ecx, r8d
        jne      G_M6289_IG17
        xor      rdi, rdi
        xor      r8d, r8d
 						;; size=14 bbWeight=0.50 PerfScore 0.88
 G_M6289_IG05:
        test     sil, sil
        jne      SHORT G_M6289_IG09
        jmp      SHORT G_M6289_IG07
 						;; size=7 bbWeight=1 PerfScore 3.25
 G_M6289_IG06:
        add      rdi, 2
        add      r8d, -2
 						;; size=8 bbWeight=4 PerfScore 2.00
 G_M6289_IG07:
        cmp      r8d, 2
        jl       G_M6289_IG12
        movzx    rsi, word  ptr [rdi]
        cmp      esi, 255
        jg       SHORT G_M6289_IG09
        mov      rdx, 0xD1FFAB1E      ; static handle
        test     byte  ptr [rsi+rdx], 1
        je       SHORT G_M6289_IG09
        jmp      SHORT G_M6289_IG06
        align    [0 bytes for IG08]
 						;; size=39 bbWeight=4 PerfScore 43.00
 G_M6289_IG08:
        add      rdi, 2
        add      r8d, -2
 						;; size=8 bbWeight=4 PerfScore 2.00
 G_M6289_IG09:
        cmp      r8d, 2
        jl       SHORT G_M6289_IG10
        movzx    rax, word  ptr [rdi]
        add      rdi, 2
        add      r8d, -2
        mov      esi, eax
        mov      rdx, 0xD1FFAB1E      ; static handle
        test     byte  ptr [rsi+rdx], 16
        jne      SHORT G_M6289_IG09
        lea      esi, [rax-0xD800]
        cmp      esi, 0x3FF
        ja       G_M6289_IG16
        cmp      r8d, 2
-       jb       SHORT G_M6289_IG15
+       jl       SHORT G_M6289_IG15
        movzx    rsi, word  ptr [rdi]
        lea      edx, [rsi-0xDC00]
        cmp      edx, 0x3FF
-       jbe      SHORT G_M6289_IG08
-       jmp      SHORT G_M6289_IG14
-						;; size=78 bbWeight=4 PerfScore 68.00
+       ja       SHORT G_M6289_IG14
+       cmp      r8d, 2
+       jae      SHORT G_M6289_IG08
+       jmp      G_M6289_IG17
+						;; size=87 bbWeight=4 PerfScore 73.00
 G_M6289_IG10:
        mov      eax, 3
 						;; size=5 bbWeight=0.50 PerfScore 0.12
 G_M6289_IG11:
        add      rsp, 8
        pop      rbx
        pop      rbp
        ret      
 						;; size=7 bbWeight=0.50 PerfScore 1.12
 G_M6289_IG12:
        mov      eax, 14
        mov      ecx, 13
        cmp      byte  ptr [rbx+0xC0], 0
        cmove    eax, ecx
 						;; size=20 bbWeight=0.50 PerfScore 1.88
 G_M6289_IG13:
        add      rsp, 8
        pop      rbx
        pop      rbp
        ret      
 						;; size=7 bbWeight=0.50 PerfScore 1.12
 G_M6289_IG14:
        mov      edi, eax
        xor      edx, edx
        xor      ecx, ecx
        xor      r8d, r8d
        mov      rax, 0xD1FFAB1E      ; code for System.Xml.XmlConvert:CreateInvalidSurrogatePairException(ushort,ushort,int,int,int):System.Exception
        call     [rax]System.Xml.XmlConvert:CreateInvalidSurrogatePairException(ushort,ushort,int,int,int):System.Exception
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=30 bbWeight=0 PerfScore 0.00
 G_M6289_IG15:
        mov      rax, 0xD1FFAB1E      ; code for System.SR:get_Xml_InvalidSurrogateMissingLowChar():System.String
        call     [rax]System.SR:get_Xml_InvalidSurrogateMissingLowChar():System.String
        mov      rsi, rax
        mov      rdi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.Xml.XmlSqlBinaryReader:CreateXmlException(System.String):System.Xml.XmlException:this
        call     [rax]System.Xml.XmlSqlBinaryReader:CreateXmlException(System.String):System.Xml.XmlException:this
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=39 bbWeight=0 PerfScore 0.00
 G_M6289_IG16:
        mov      edi, eax
        xor      esi, esi
        mov      edx, 1
        mov      rax, 0xD1FFAB1E      ; code for System.Xml.XmlConvert:CreateInvalidCharException(ushort,ushort,int):System.Exception
        call     [rax]System.Xml.XmlConvert:CreateInvalidCharException(ushort,ushort,int):System.Exception
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=30 bbWeight=0 PerfScore 0.00
 G_M6289_IG17:
        mov      rax, 0xD1FFAB1E      ; code for System.ThrowHelper:ThrowArgumentOutOfRangeException()
        call     [rax]System.ThrowHelper:ThrowArgumentOutOfRangeException()
        int3     
 						;; size=13 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 372, prolog size 11, PerfScore 138.50, instruction count 104, allocated bytes for code 372 (MethodHash=9dc8e76e) for method System.Xml.XmlSqlBinaryReader:CheckText(ubyte):int:this (FullOpts)
+; Total bytes of code 381, prolog size 11, PerfScore 143.50, instruction count 106, allocated bytes for code 381 (MethodHash=9dc8e76e) for method System.Xml.XmlSqlBinaryReader:CheckText(ubyte):int:this (FullOpts)
 ; ============================================================

@MihuBot
Copy link
Owner Author

MihuBot commented Oct 5, 2024

@xtqqczze

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants