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

Add size_t versions of Atomic::add, dec, and inc

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b08

      Description

      There's no Atomic:add version that operates on size_t typed variables. Instead the code resort to use Atomic::add_ptr, which takes an intptr_t.

      By adding size versions of Atomic::add, dec, and inc, we could clean up the code base to use more correct types for our variables used with Atomic operations.

      One example:
      volatile intptr_t MetaspaceGC::_capacity_until_GC = 0;

      is used as a size_t, but declared intptr_t to work well with:
      size_t MetaspaceGC::inc_capacity_until_GC(size_t v) {
        assert_is_size_aligned(v, Metaspace::commit_alignment());

        return (size_t)Atomic::add_ptr(v, &_capacity_until_GC);
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dsimms David Simms
              Reporter:
              stefank Stefan Karlsson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: