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

C2 with Zero based COOP produces code with broken anti-dependency on x86

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: hs17
    • Fix Version/s: hs19
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b06
    • CPU:
      x86
    • OS:
      solaris_10
    • Verification:
      Verified

      Backports

        Description

        For the next code:

          void test (A new_next) {
            A prev_next = a.next;
            a.next = new_next;
            if (prev_next == null) {
              a.n = a.get_n();
            }
          }

        C2 prodes next incorrect assembler code (64 bit x86) with Zero based COOP produces:

        02c movl RBP, [RSI + #12 (8-bit)] # compressed ptr ! Field Test.a
        030 cmpl R12, [R12 + RBP << 3 + #16] (compressed oop addressing) # compressed ptr (R12_heapbase==0)
        035 NullCheck RBP
        035
        035 B2: # B4 B3 <- B1 Freq: 0.999999
        035 decode_heap_oop_not_null RSI,RBP
        039 encode_heap_oop R11,RDX
        040 movl [R12 + RBP << 3 + #16] (compressed oop addressing), R11 # compressed ptr ! Field A.next
        045 movq R10, RSI # ptr -> long
        048 shrq R10, #9
        04c movq R11, 0xfffffd7ff4a1c000 # ptr
        056 movb [R11 + R10], R12 # short/char (R12_heapbase==0)
        05a cmpl R12, [R12 + RBP << 3 + #16] (compressed oop addressing) # compressed ptr (R12_heapbase==0)
        05f je,s B4 P=0.100000 C=-1.000000
        05f

        The test in 05a checks wrong (new_next) value.

        % /java/re/jdk/6u21/latest/binaries/solaris-amd64/bin/java -d64 -XX:+UseCompressedOops -XX:+UnlockDiagnosticVMOptions -XX:+PrintCompressedOopsMode -Xbatch -XX:+PrintCompilation -Xcomp -XX:CompileOnly=Test Test

        heap address: 0x00000003fc800000, zero based Compressed Oops

          1 b Test::main (91 bytes)
          1 made not entrant Test::main (91 bytes)
          2 b Test::<init> (5 bytes)
          3 b Test::test (35 bytes)
        Wrong value: 1 expected: 2

        I will include the test into the C2 regression tests.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                kvn Vladimir Kozlov
                Reporter:
                kvn Vladimir Kozlov
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: