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

ZGC: Set mark bit with unconditional atomic ops

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 20
    • hotspot
    • gc

      **Motivation**
      ZGC currently modify mark-bitmap by a conditional atomic operation (cmpxchg). This way is not optimal, which will retry the loop when cmpxchg fails.

      First, This patch-set add an new unconditional atomic operation: Atomic::fetch_and_or, which is implemented in different ways for different CPU architectures:

      * Exclusive access: non-nested loop

      ```
      retry:
        ll old_val, addr
        or new_val, old_val, set_val
        sc new_val, addr
        beq retry
      ```

      * Atomic access: one instruction

      ```
      ldset old_val, set_val, addr
      ```

      * Generic: fallback to cmpxchg or use c++ __atomic_fetch_or

      **Testing**
      * jtreg tests
      * benchmark tests

      Assigned to wangrui.

      Thanks,
      Leslie ZHai

            Unassigned Unassigned
            lzhai Leslie Zhai
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: