< prev index next >
src/hotspot/share/gc/z/zForwarding.inline.hpp
Print this page
@@ -52,20 +52,20 @@
inline bool ZForwarding::is_pinned() const {
return Atomic::load(&_pinned);
}
inline void ZForwarding::set_pinned() {
- Atomic::store(true, &_pinned);
+ Atomic::store(&_pinned, true);
}
inline bool ZForwarding::inc_refcount() {
uint32_t refcount = Atomic::load(&_refcount);
while (refcount > 0) {
const uint32_t old_refcount = refcount;
const uint32_t new_refcount = old_refcount + 1;
- const uint32_t prev_refcount = Atomic::cmpxchg(new_refcount, &_refcount, old_refcount);
+ const uint32_t prev_refcount = Atomic::cmpxchg(&_refcount, old_refcount, new_refcount);
if (prev_refcount == old_refcount) {
return true;
}
refcount = prev_refcount;
@@ -74,11 +74,11 @@
return false;
}
inline bool ZForwarding::dec_refcount() {
assert(_refcount > 0, "Invalid state");
- return Atomic::sub(1u, &_refcount) == 0u;
+ return Atomic::sub(&_refcount, 1u) == 0u;
}
inline bool ZForwarding::retain_page() {
return inc_refcount();
}
@@ -137,11 +137,11 @@
inline uintptr_t ZForwarding::insert(uintptr_t from_index, uintptr_t to_offset, ZForwardingCursor* cursor) {
const ZForwardingEntry new_entry(from_index, to_offset);
const ZForwardingEntry old_entry; // Empty
for (;;) {
- const ZForwardingEntry prev_entry = Atomic::cmpxchg(new_entry, entries() + *cursor, old_entry);
+ const ZForwardingEntry prev_entry = Atomic::cmpxchg(entries() + *cursor, old_entry, new_entry);
if (!prev_entry.populated()) {
// Success
return to_offset;
}
< prev index next >