--- old/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp 2019-11-21 11:58:02.511864602 +0100 +++ new/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp 2019-11-21 11:58:01.995855888 +0100 @@ -87,7 +87,7 @@ const int current_msgs = Atomic::load(&_messages); // OR the new message const int exchange_value = current_msgs | new_messages; - const int result = Atomic::cmpxchg(exchange_value, &_messages, current_msgs); + const int result = Atomic::cmpxchg(&_messages, current_msgs, exchange_value); if (result == current_msgs) { return; } @@ -139,7 +139,7 @@ int JfrPostBox::collect() { // get pending and reset to 0 - const int messages = Atomic::xchg(0, &_messages); + const int messages = Atomic::xchg(&_messages, 0); if (check_waiters(messages)) { _has_waiters = true; assert(JfrMsg_lock->owned_by_self(), "incrementing _msg_read_serial is protected by JfrMsg_lock");