equal
deleted
inserted
replaced
279 if (refc == PERM_REFCOUNT) { |
279 if (refc == PERM_REFCOUNT) { |
280 return true; // sticky max or created permanent |
280 return true; // sticky max or created permanent |
281 } else if (refc == 0) { |
281 } else if (refc == 0) { |
282 return false; // dead, can't revive. |
282 return false; // dead, can't revive. |
283 } else { |
283 } else { |
284 found = Atomic::cmpxchg(old_value + 1, &_length_and_refcount, old_value); |
284 found = Atomic::cmpxchg(&_length_and_refcount, old_value, old_value + 1); |
285 if (found == old_value) { |
285 if (found == old_value) { |
286 return true; // successfully updated. |
286 return true; // successfully updated. |
287 } |
287 } |
288 // refcount changed, try again. |
288 // refcount changed, try again. |
289 } |
289 } |
322 print(); |
322 print(); |
323 fatal("refcount underflow"); |
323 fatal("refcount underflow"); |
324 #endif |
324 #endif |
325 return; |
325 return; |
326 } else { |
326 } else { |
327 found = Atomic::cmpxchg(old_value - 1, &_length_and_refcount, old_value); |
327 found = Atomic::cmpxchg(&_length_and_refcount, old_value, old_value - 1); |
328 if (found == old_value) { |
328 if (found == old_value) { |
329 return; // successfully updated. |
329 return; // successfully updated. |
330 } |
330 } |
331 // refcount changed, try again. |
331 // refcount changed, try again. |
332 } |
332 } |
346 fatal("refcount underflow"); |
346 fatal("refcount underflow"); |
347 #endif |
347 #endif |
348 return; |
348 return; |
349 } else { |
349 } else { |
350 int len = extract_length(old_value); |
350 int len = extract_length(old_value); |
351 found = Atomic::cmpxchg(pack_length_and_refcount(len, PERM_REFCOUNT), &_length_and_refcount, old_value); |
351 found = Atomic::cmpxchg(&_length_and_refcount, old_value, pack_length_and_refcount(len, PERM_REFCOUNT)); |
352 if (found == old_value) { |
352 if (found == old_value) { |
353 return; // successfully updated. |
353 return; // successfully updated. |
354 } |
354 } |
355 // refcount changed, try again. |
355 // refcount changed, try again. |
356 } |
356 } |