def retry_update(x, hash_code, was_uncontended)
hash = hash_code
collided = false
while true
if current_cells = cells
if !(cell = current_cells.volatile_get_by_hash(hash))
if busy?
collided = false
else
if try_to_install_new_cell(Cell.new(x), hash)
break
else
redo
end
end
elsif !was_uncontended
was_uncontended = true
elsif cell.cas_computed {|current_value| yield current_value}
break
elsif current_cells.size >= CPU_COUNT || cells != current_cells
collided = false
elsif collided && expand_table_unless_stale(current_cells)
collided = false
redo
else
collided = true
end
hash = XorShiftRandom.xorshift(hash)
elsif try_initialize_cells(x, hash) || cas_base_computed {|current_base| yield current_base}
break
end
end
self.hash_code = hash
end