< prev index next >
src/hotspot/share/gc/z/zForwarding.inline.hpp
Print this page
*** 117,129 ****
}
inline ZForwardingEntry ZForwarding::find(uintptr_t from_index, ZForwardingCursor* cursor) const {
// Reading entries in the table races with the atomic CAS done for
// insertion into the table. This is safe because each entry is at
! // most updated once (from -1 to something else).
ZForwardingEntry entry = first(from_index, cursor);
! while (!entry.is_empty()) {
if (entry.from_index() == from_index) {
// Match found, return matching entry
return entry;
}
--- 117,129 ----
}
inline ZForwardingEntry ZForwarding::find(uintptr_t from_index, ZForwardingCursor* cursor) const {
// Reading entries in the table races with the atomic CAS done for
// insertion into the table. This is safe because each entry is at
! // most updated once (from zero to something else).
ZForwardingEntry entry = first(from_index, cursor);
! while (entry.populated()) {
if (entry.from_index() == from_index) {
// Match found, return matching entry
return entry;
}
*** 138,155 ****
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);
! if (prev_entry.is_empty()) {
// Success
return to_offset;
}
// Find next empty or matching entry
ZForwardingEntry entry = at(cursor);
! while (!entry.is_empty()) {
if (entry.from_index() == from_index) {
// Match found, return already inserted address
return entry.to_offset();
}
--- 138,155 ----
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);
! if (!prev_entry.populated()) {
// Success
return to_offset;
}
// Find next empty or matching entry
ZForwardingEntry entry = at(cursor);
! while (entry.populated()) {
if (entry.from_index() == from_index) {
// Match found, return already inserted address
return entry.to_offset();
}
< prev index next >