int i;
int t = get_thread_num();
for (i = 0; i < MAX_FREELIST; i++) {
- unsigned int node = load_32(&free_lists[t][i]);
- //unsigned int node = free_lists[t][i];
+ //unsigned int node = load_32(&free_lists[t][i]);
+ unsigned int node = free_lists[t][i];
if (node) {
- store_32(&free_lists[t][i], 0);
- //free_lists[t][i] = 0;
+ //store_32(&free_lists[t][i], 0);
+ free_lists[t][i] = 0;
return node;
}
}
for (i = 0; i < MAX_FREELIST; i++) {
/* Should never race with our own thread here */
- unsigned int idx = load_32(&free_lists[t][i]);
- //unsigned int idx = free_lists[t][i];
+ //unsigned int idx = load_32(&free_lists[t][i]);
+ unsigned int idx = free_lists[t][i];
/* Found empty spot in free list */
if (idx == 0) {
pointer tmp;
node = new_node();
- store_32(&q->nodes[node].value, val);
- //q->nodes[node].value = val;
+ //store_32(&q->nodes[node].value, val);
+ q->nodes[node].value = val;
tmp = atomic_load_explicit(&q->nodes[node].next, relaxed);
set_ptr(&tmp, 0); // NULL
atomic_store_explicit(&q->nodes[node].next, tmp, relaxed);
@Label: Enqueue_Clear
@End
*/
- /**** detected UL ****/
+ /**** UL & inadmissible ****/
tail = atomic_load_explicit(&q->tail, acquire);
/****FIXME: miss ****/
next = atomic_load_explicit(&q->nodes[get_ptr(tail)].next, acquire);
if (get_ptr(next) == 0) { // == NULL
pointer value = MAKE_POINTER(node, get_count(next) + 1);
- /**** detected UL ****/
+ /**** SPEC Error (testcase1.c) ****/
// Second release can be just relaxed
success = atomic_compare_exchange_strong_explicit(&q->nodes[get_ptr(tail)].next,
&next, value, release, relaxed);
}
if (!success) {
// This routine helps the other enqueue to update the tail
- /**** detected UL ****/
+ /**** UL & Inadmissible ****/
unsigned int ptr = get_ptr(atomic_load_explicit(&q->nodes[get_ptr(tail)].next, acquire));
pointer value = MAKE_POINTER(ptr,
get_count(tail) + 1);
}
}
}
- /**** dectected UL ****/
+ /**** UL & Inadmissible ****/
// Second release can be just relaxed
bool succ = atomic_compare_exchange_strong_explicit(&q->tail,
&tail,
@Label: Dequeue_Clear
@End
*/
- /**** detected correctness error ****/
+ /**** Inadmissible ****/
head = atomic_load_explicit(&q->head, acquire);
+ /**
+ @Begin
+ @Commit_point_define_check: true
+ @Label: DequeueReadHead
+ @End
+ */
+
/** A new bug has been found here!!! It should be acquire instead of
* relaxed (it introduces a bug when there's two dequeuers and one
* enqueuer) correctness bug!!
*/
+ /**** New bug ****/
tail = atomic_load_explicit(&q->tail, acquire);
- /**** Detected UL/DR (testcase1.c) ****/
- next = atomic_load_explicit(&q->nodes[get_ptr(head)].next, acquire);
+ /**** SPEC Error (testcase1.c) ****/
+ next = atomic_load_explicit(&q->nodes[get_ptr(head)].next, relaxed);
/**
@Begin
@Potential_commit_point_define: true
if (get_ptr(next) == 0) { // NULL
return false; // NULL
}
- /**** Detected UL (testcase1.c) ****/
+ /**** FIXME: miss ****/
// Second release can be just relaxed
bool succ = false;
succ = atomic_compare_exchange_strong_explicit(&q->tail,
//printf("miss4_dequeue\n");
thrd_yield();
} else {
- value = load_32(&q->nodes[get_ptr(next)].value);
- //value = q->nodes[get_ptr(next)].value;
- /**** correctness error ****/
+ //value = load_32(&q->nodes[get_ptr(next)].value);
+ value = q->nodes[get_ptr(next)].value;
+ /**** inadmissibility ****/
success = atomic_compare_exchange_strong_explicit(&q->head,
&head,
MAKE_POINTER(get_ptr(next), get_count(head) + 1),