--- old/src/hotspot/os/bsd/os_bsd.cpp 2019-11-21 11:56:43.442528938 +0100 +++ new/src/hotspot/os/bsd/os_bsd.cpp 2019-11-21 11:56:43.010521639 +0100 @@ -930,7 +930,7 @@ if (now <= prev) { return prev; // same or retrograde time; } - const uint64_t obsv = Atomic::cmpxchg(now, &Bsd::_max_abstime, prev); + const uint64_t obsv = Atomic::cmpxchg(&Bsd::_max_abstime, prev, now); assert(obsv >= prev, "invariant"); // Monotonicity // If the CAS succeeded then we're done and return "now". // If the CAS failed and the observed value "obsv" is >= now then @@ -1833,7 +1833,7 @@ for (;;) { for (int i = 0; i < NSIG + 1; i++) { jint n = pending_signals[i]; - if (n > 0 && n == Atomic::cmpxchg(n - 1, &pending_signals[i], n)) { + if (n > 0 && n == Atomic::cmpxchg(&pending_signals[i], n, n - 1)) { return i; } } @@ -1894,7 +1894,7 @@ } char buf[PATH_MAX + 1]; - int num = Atomic::add(1, &cnt); + int num = Atomic::add(&cnt, 1); snprintf(buf, PATH_MAX + 1, "%s/hs-vm-%d-%d", os::get_temp_directory(), os::current_process_id(), num); @@ -3237,7 +3237,7 @@ mapping[i] = -1; } - if (!Atomic::replace_if_null(mapping, &apic_to_processor_mapping)) { + if (!Atomic::replace_if_null(&apic_to_processor_mapping, mapping)) { FREE_C_HEAP_ARRAY(int, mapping); mapping = Atomic::load_acquire(&apic_to_processor_mapping); } @@ -3263,8 +3263,8 @@ int processor_id = Atomic::load(&mapping[apic_id]); while (processor_id < 0) { - if (Atomic::cmpxchg(-2, &mapping[apic_id], -1)) { - Atomic::store(Atomic::add(1, &next_processor_id) - 1, &mapping[apic_id]); + if (Atomic::cmpxchg(&mapping[apic_id], -1, -2)) { + Atomic::store(&mapping[apic_id], Atomic::add(&next_processor_id, 1) - 1); } processor_id = Atomic::load(&mapping[apic_id]); }