--- old/src/hotspot/share/utilities/lockFreeStack.hpp 2019-11-21 11:58:40.988514309 +0100 +++ new/src/hotspot/share/utilities/lockFreeStack.hpp 2019-11-21 11:58:40.492505935 +0100 @@ -65,7 +65,7 @@ do { old = cur; set_next(*last, cur); - cur = Atomic::cmpxchg(first, &_top, cur); + cur = Atomic::cmpxchg(&_top, cur, first); } while (old != cur); } @@ -91,7 +91,7 @@ new_top = next(*result); } // CAS even on empty pop, for consistent membar bahavior. - result = Atomic::cmpxchg(new_top, &_top, result); + result = Atomic::cmpxchg(&_top, result, new_top); } while (result != old); if (result != NULL) { set_next(*result, NULL); @@ -103,7 +103,7 @@ // list of elements. Acts as a full memory barrier. // postcondition: empty() T* pop_all() { - return Atomic::xchg((T*)NULL, &_top); + return Atomic::xchg(&_top, (T*)NULL); } // Atomically adds value to the top of this stack. Acts as a full @@ -170,7 +170,7 @@ // if value is in an instance of this specialization of LockFreeStack, // there must be no concurrent push or pop operations on that stack. static void set_next(T& value, T* new_next) { - Atomic::store(new_next, next_ptr(value)); + Atomic::store(next_ptr(value), new_next); } };