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

aarch64: rflags is not correct after safepoint poll

    XMLWordPrintable

Details

    • b24
    • aarch64
    • generic

    Backports

      Description

        Currently, the rflags register is not handled in push_CPU_state and pop_CPU_state for the aarch64 port.
        This is causing random Hadoop Terasort failure using a aarch64-8u jvm.
        After some investigation, we located the problematic C2 JIT code snippet:

        1204 0x0000ffff785f8a3c: cmp w14, #0x0
        1205 0x0000ffff785f8a40: adrp x11, 0x0000ffff88830000
        1206 ; {poll}
        1207 0x0000ffff785f8a44: mov w17, w20 ; OopMap{r17=NarrowOop [32]=Oop [40]=Oop [56]=Oop [64]=Oop [80]=NarrowOop off=1224}
        1208 ;*ifeq
        1209 ; - org.apache.hadoop.util.PriorityQueue::downHeap@121 (line 149)
        1210 ; - org.apache.hadoop.util.PriorityQueue::adjustTop@1 (line 108)
        1211 ; - org.apache.hadoop.mapred.Merger$MergeQueue::adjustPriorityQueue@59 (line 595)
        1212 ; - org.apache.hadoop.mapred.Merger$MergeQueue::next@25 (line 618)
        1213
        1214 0x0000ffff785f8a48: ldr wzr, [x11] ; {poll}
        1215 0x0000ffff785f8a4c: csel w24, w12, w10, lt ;*invokevirtual compareTo
        1216 ; - org.apache.hadoop.io.FastByteComparisons$LexicographicalComparerHolder$UnsafeComparer::compareTo@16 ( line 132)
        1217 ; - org.apache.hadoop.io.FastByteComparisons::compareTo@11 (line 46)
        1218 ; - org.apache.hadoop.io.WritableComparator::compareBytes@8 (line 188)
        1219 ; - org.apache.hadoop.io.Text$Comparator::compare@39 (line 368)
        1220 ; - org.apache.hadoop.mapred.Merger$MergeQueue::lessThan@70 (line 658)
        1221 ; - org.apache.hadoop.util.PriorityQueue::downHeap@41 (line 141)
        1222 ; - org.apache.hadoop.util.PriorityQueue::adjustTop@1 (line 108)
        1223 ; - org.apache.hadoop.mapred.Merger$MergeQueue::adjustPriorityQueue@59 (line 595)
        1224 ; - org.apache.hadoop.mapred.Merger$MergeQueue::next@25 (line 618)

        At line 1204, the rflags register is defined and it will be used at line 1215. There is a safepoint poll in between at line 1214.
        Safepoint is requested at line 1214 and the control flow continues in the code generated by SafepointBlob* SharedRuntime::generate_handler_blob
        This blob calls save_live_register and restore_live_registers which will finally calls push_CPU_state and pop_CPU_state.
        As the rflags register is not saved and restored by push_CPU_state and pop_CPU_state, we see an invalid rflags at line 1215.

        Attachments

          1. fix-v0.diff
            4 kB
          2. MergeQueue_next.C2.asm
            765 kB
          3. Merger.java
            33 kB

          Issue Links

            Activity

              People

                fyang Fei Yang
                fyang Fei Yang
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: