equal
deleted
inserted
replaced
61 uint32_t refcount = Atomic::load(&_refcount); |
61 uint32_t refcount = Atomic::load(&_refcount); |
62 |
62 |
63 while (refcount > 0) { |
63 while (refcount > 0) { |
64 const uint32_t old_refcount = refcount; |
64 const uint32_t old_refcount = refcount; |
65 const uint32_t new_refcount = old_refcount + 1; |
65 const uint32_t new_refcount = old_refcount + 1; |
66 const uint32_t prev_refcount = Atomic::cmpxchg(new_refcount, &_refcount, old_refcount); |
66 const uint32_t prev_refcount = Atomic::cmpxchg(&_refcount, old_refcount, new_refcount); |
67 if (prev_refcount == old_refcount) { |
67 if (prev_refcount == old_refcount) { |
68 return true; |
68 return true; |
69 } |
69 } |
70 |
70 |
71 refcount = prev_refcount; |
71 refcount = prev_refcount; |
137 inline uintptr_t ZForwarding::insert(uintptr_t from_index, uintptr_t to_offset, ZForwardingCursor* cursor) { |
137 inline uintptr_t ZForwarding::insert(uintptr_t from_index, uintptr_t to_offset, ZForwardingCursor* cursor) { |
138 const ZForwardingEntry new_entry(from_index, to_offset); |
138 const ZForwardingEntry new_entry(from_index, to_offset); |
139 const ZForwardingEntry old_entry; // Empty |
139 const ZForwardingEntry old_entry; // Empty |
140 |
140 |
141 for (;;) { |
141 for (;;) { |
142 const ZForwardingEntry prev_entry = Atomic::cmpxchg(new_entry, entries() + *cursor, old_entry); |
142 const ZForwardingEntry prev_entry = Atomic::cmpxchg(entries() + *cursor, old_entry, new_entry); |
143 if (!prev_entry.populated()) { |
143 if (!prev_entry.populated()) { |
144 // Success |
144 // Success |
145 return to_offset; |
145 return to_offset; |
146 } |
146 } |
147 |
147 |