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

Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • b48
    • generic
    • generic

        Some code in hotspot depends on Atomic::xchg to be a full memory barrier. Example:


        void Parker::park(bool isAbsolute, jlong time) {
          // Ideally we'd do something useful while spinning, such
          // as calling unpackTime().

          // Optional fast-path check:
          // Return immediately if a permit is available.
          // We depend on Atomic::xchg() having full barrier semantics
          // since we are doing a lock-free update to _counter.
          if (Atomic::xchg(0, &_counter) > 0) return;


        However, the Zero implementation is not implemented as a full memory barrier.

              sgehwolf Severin Gehwolf
              sgehwolf Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: