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

Harmonize parameter order in Atomic

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Delivered
    • Affects Version/s: 14
    • Fix Version/s: 14
    • Component/s: hotspot
    • Labels:
      None

      Description

      These are some of the functions used to concurrently write memory from HotSpot C++ code:

      Atomic::store(value, destination);
      OrderAccess::release_store(destination, value)
      OrderAccess::release_store_fence(destination, value)
      Atomic::add(value, destination);
      Atomic::sub(value, destination);
      Atomic::xchg(exchange_value, destination);
      Atomic::cmpxchg(exchange_value, destination, compare_value);

      With the proposed JDK-8234562 change, this would look like:

      Atomic::store(value, destination);
      Atomic::release_store(destination, value)
      Atomic::release_store_fence(destination, value)
      Atomic::add(value, destination);
      Atomic::sub(value, destination);
      Atomic::xchg(exchange_value, destination);
      Atomic::cmpxchg(exchange_value, destination, compare_value);

      I'd like to propose that we move the destination parameter over to the left, and the new value to the right. This would look like this:

      Atomic::store(destination, value);
      Atomic::release_store(destination, value)
      Atomic::release_store_fence(destination, value)
      Atomic::add(destination, value);
      Atomic::sub(destination, value);
      Atomic::xchg(destination, exchange_value);
      Atomic::cmpxchg(destination, compare_value, exchange_value);

      This would bring the Atomic API more in-line with order for a normal store:

      *destination = value;

      and to me and many others are a more natural parameter order.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stefank Stefan Karlsson
                Reporter:
                stefank Stefan Karlsson
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: