Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6984889

Consecutive equivalent comparisons should be merged

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P5 P5
    • None
    • 7, 9, 10
    • hotspot
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      Different isXyz() methods often compare on same boundary. If
      consecutive, after HotSpot inlining one of those compares could be saved.


      JUSTIFICATION :
      - performance
      - memory usage


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -

        0x00b86587: cmp $0xd800,%ecx
        0x00b8658d: jl 0x00b865a6
        0x00b8658f: cmp $0xdc00,%ecx
        0x00b86595: jl 0x00b865aa ;*if_icmplt
                                              ; -
      java.lang.Character::isHighSurrogate@3 (line 2795)
                                              ; -
      java.lang.Benchmark::isSurrogate@1 (line 7)
        0x00b86597: cmp $0xe000,%ecx
        0x00b8659d: jge 0x00b865a6 ;*if_icmpge
                                              ; -
      java.lang.Character::isLowSurrogate@9 (line 2819)
                                              ; -
      java.lang.Benchmark::isSurrogate@13 (line 9)
        0x00b8659f: mov $0x1,%eax
        0x00b865a4: jmp 0x00b865af ;*if_icmplt
                                              ; -
      java.lang.Character::isLowSurrogate@3 (line 2819)
                                              ; -
      java.lang.Benchmark::isSurrogate@13 (line 9)
        0x00b865a6: xor %eax,%eax
        0x00b865a8: jmp 0x00b865af
        0x00b865aa: mov $0x2,%eax ;*goto
                                              ; -
      java.lang.Benchmark::isSurrogate@21 (line 10)
        0x00b865af: add $0x8,%esp
        0x00b865b2: pop %ebp
        0x00b865b3: test %eax,0x390000 ; {poll_return}
        0x00b865b9: ret

      ACTUAL -

        0x00b86587: cmp $0xd800,%ecx
        0x00b8658d: jl 0x00b86597
        0x00b8658f: cmp $0xdc00,%ecx
        0x00b86595: jl 0x00b865b2 ;*if_icmplt
                                              ; -
      java.lang.Character::isHighSurrogate@3 (line 2795)
                                              ; -
      java.lang.Benchmark::isSurrogate@1 (line 7)
        0x00b86597: cmp $0xdc00,%ecx
        0x00b8659d: jl 0x00b865ae ;*if_icmplt
                                              ; -
      java.lang.Character::isLowSurrogate@3 (line 2819)
                                              ; -
      java.lang.Benchmark::isSurrogate@13 (line 9)
        0x00b8659f: cmp $0xe000,%ecx
        0x00b865a5: jge 0x00b865ae ;*if_icmpge
                                              ; -
      java.lang.Character::isLowSurrogate@9 (line 2819)
                                              ; -
      java.lang.Benchmark::isSurrogate@13 (line 9)
        0x00b865a7: mov $0x1,%eax
        0x00b865ac: jmp 0x00b865b7 ;*if_icmplt
                                              ; -
      java.lang.Character::isLowSurrogate@3 (line 2819)
                                              ; -
      java.lang.Benchmark::isSurrogate@13 (line 9)
        0x00b865ae: xor %eax,%eax
        0x00b865b0: jmp 0x00b865b7
        0x00b865b2: mov $0x2,%eax ;*goto
                                              ; -
      java.lang.Benchmark::isSurrogate@21 (line 10)
        0x00b865b7: add $0x8,%esp
        0x00b865ba: pop %ebp
        0x00b865bb: test %eax,0x390000 ; {poll_return}
        0x00b865c1: ret


      ---------- BEGIN SOURCE ----------

              int n;
              if (Character.isHighSurrogate(c))
                  n = 2;
              else if (Character.isLowSurrogate(c))
                  n = 1;
              else
                  n = 0;


      ---------- END SOURCE ----------

            rbackman Rickard Backman (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: