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

ZGC: Set mark bit with unconditional atomic ops

    XMLWordPrintable

Details

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

    Description

      **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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: