//Watch out: actually on need to be an acquire (don't count it)
// An old bug
size_t t = atomic_load_explicit(&q->top, memory_order_acquire);
- /**
- //@Begin
- @Potential_commit_point_define: true
- @Label: Steal_Potential_Read_Tail
- @End
- */
//FIXME: remove the fence causes no error and fewer executions..
atomic_thread_fence(memory_order_seq_cst);
/**** SPEC & UL ****/
@Label: Steal_Read_Bottom
@End
*/
-
- /**
- //@Begin
- @Commit_point_define: t >= b
- @Potential_commit_point_label: Steal_Potential_Read_Tail
- @Label: Steal_Read_Tail
- @End
- */
int x = EMPTY;
if (t < b) {
/* Non-empty queue. */
/**** detected UL ****/
Array *a = (Array *) atomic_load_explicit(&q->array, memory_order_acquire);
- /**
- //@Begin
- @Commit_point_define_check: true
- @Label: Steal_Read_Array
- @End
- */
int size = atomic_load_explicit(&a->size, memory_order_relaxed);
x = atomic_load_explicit(&a->buffer[t % size], memory_order_relaxed);
- /**
- //@Begin
- @Potential_commit_point_define: true
- @Label: Steal_Potential_Read_Buffer
- @End
- */
/**** SPEC (sequential) ****/
bool succ = atomic_compare_exchange_strong_explicit(&q->top, &t, t + 1,
memory_order_seq_cst, memory_order_relaxed);
- /**
- //@Begin
- @Commit_point_define_check: succ
- @Label: Steal_CAS_Top
- @End
- */
-
/**
@Begin
@Additional_ordering_point_define_check: true
@Label: Steal_Additional_Point
@End
*/
-
- /**
- //@Begin
- @Commit_point_define: succ
- @Potential_commit_point_label: Steal_Potential_Read_Buffer
- @Label: Steal_Read_Buffer
- @End
- */
if (!succ) {
/* Failed race. */
return ABORT;
atomic_store_explicit(&q->nodes[node].next, tmp, relaxed);
while (!success) {
-
- /**
- @Begin
- @Commit_point_clear: true
- @Label: Enqueue_Clear
- @End
- */
/**** UL & inadmissible ****/
tail = atomic_load_explicit(&q->tail, acquire);
/****FIXME: miss ****/
// Second release can be just relaxed
bool succ = false;
succ = atomic_compare_exchange_strong_explicit(&q->tail,
- &tail, value, relaxed, relaxed);
+ &tail, value, release, relaxed);
if (succ) {
//printf("miss2_enqueue CAS succ\n");
}
}
}
}
- /**** UL & Inadmissible ****/
+ /**** UL & Inadmissible (main.c) ****/
// Second release can be just relaxed
bool succ = atomic_compare_exchange_strong_explicit(&q->tail,
&tail,
@Label: Dequeue_Clear
@End
*/
- /**** Inadmissible ****/
+
+ /**** Inadmissible (main.c) ****/
head = atomic_load_explicit(&q->head, acquire);
/**
@Begin
/**** SPEC Error (testcase1.c) ****/
next = atomic_load_explicit(&q->nodes[get_ptr(head)].next, acquire);
- /**
- @Begin
- @Potential_commit_point_define: true
- @Label: DequeueReadNext
- @End
- */
if (atomic_load_explicit(&q->head, relaxed) == head) {
if (get_ptr(head) == get_ptr(tail)) {
} else {
//value = load_32(&q->nodes[get_ptr(next)].value);
value = q->nodes[get_ptr(next)].value;
- /**** inadmissibility ****/
+ /**** inadmissibility (main.c) ****/
success = atomic_compare_exchange_strong_explicit(&q->head,
&head,
MAKE_POINTER(get_ptr(next), get_count(head) + 1),
@Label: DequeueUpdateHead
@End
*/
-
- /**
- @Begin
- @Commit_point_define: success
- @Potential_commit_point_label: DequeueReadNext
- @Label: DequeueReadNextVerify
- @End
- */
if (!success)
thrd_yield();
}