kvs_data* copy_slot_and_check(cliffc_hashtable *topmap, kvs_data
*oldkvs, int idx, void *should_help) {
- kvs_data *newkvs = _newkvs.load(memory_order_relaxed);
+ kvs_data *newkvs = _newkvs.load(memory_order_acquire);
// We're only here cause the caller saw a Prime
if (copy_slot(topmap, idx, oldkvs, newkvs))
copy_check_and_promote(topmap, oldkvs, 1); // Record the slot copied
// Promote the new table to the current table
if (copyDone + workdone == oldlen &&
topmap->_kvs.load(memory_order_relaxed) == oldkvs) {
- kvs_data *newkvs = _newkvs.load(memory_order_relaxed);
+ kvs_data *newkvs = _newkvs.load(memory_order_acquire);
topmap->_kvs.compare_exchange_strong(oldkvs, newkvs, memory_order_release,
memory_order_relaxed);
}
TypeV* get(TypeK *key) {
slot *key_slot = new slot(false, key);
int fullhash = hash(key_slot);
- kvs_data *kvs = _kvs.load(memory_order_relaxed);
+ kvs_data *kvs = _kvs.load(memory_order_acquire);
slot *V = get_impl(this, kvs, key_slot, fullhash);
if (V == NULL) return NULL;
MODEL_ASSERT (!is_prime(V));
key_slot == TOMBSTONE) {
// Retry in new table
// Atomic read can be here
- kvs_data *newkvs = chm->_newkvs.load(memory_order_relaxed);
+ kvs_data *newkvs = chm->_newkvs.load(memory_order_acquire);
/**
@Begin
@Commit_point_define_check: newkvs == NULL
slot *key_slot = new slot(false, key);
slot *value_slot = new slot(false, value);
- kvs_data *kvs = _kvs.load(memory_order_relaxed);
+ kvs_data *kvs = _kvs.load(memory_order_acquire);
slot *res = putIfMatch(this, kvs, key_slot, value_slot, old_val);
// Only when copy_slot() call putIfMatch() will it return NULL
MODEL_ASSERT (res != NULL);
// Here it tries to resize cause it doesn't want other threads to stop
// its progress (eagerly try to resize soon)
- newkvs = chm->_newkvs.load(memory_order_relaxed);
+ newkvs = chm->_newkvs.load(memory_order_acquire);
if (newkvs == NULL &&
((V == NULL && chm->table_full(reprobe_cnt, len)) || is_prime(V))) {
//model_print("resize2\n");
// Help along an existing table-resize. This is a fast cut-out wrapper.
kvs_data* help_copy(kvs_data *helper) {
- kvs_data *topkvs = _kvs.load(memory_order_relaxed);
+ kvs_data *topkvs = _kvs.load(memory_order_acquire);
CHM *topchm = get_chm(topkvs);
// No cpy in progress
if (topchm->_newkvs.load(memory_order_relaxed) == NULL) return helper;