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

Harmonize parameter order in Atomic

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Delivered
    • P4
    • 14
    • 14
    • hotspot
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: