2 #include "libinterface.h"
5 // atomic<struct node*> next;
9 node(MCID _md, int d = 0) : data(d) {
10 MC2_nextOpStore(MCID_NODEP, MCID_NODEP);
20 MCID _mn; node* n = new node (MCID_NODEP); _mn = MC2_function(0, MC2_PTR_LENGTH, (uint64_t) n);
29 void enqueue(MCID _mdata, int data)
31 MCID _mn; node* n = new node(MCID_NODEP, data); _mn = MC2_function(0, MC2_PTR_LENGTH, (uint64_t) n);
32 MC2_nextOpStore(MCID_NODEP, _mn);
33 store_64(&head->next->data, (uint64_t)n);
56 void * _p0 = &t->next;
57 MCID _fn0 = MC2_function(1, MC2_PTR_LENGTH, (uint64_t)_p0, MCID_NODEP); _mn=MC2_nextOpLoad(_fn0); node* n = (node *)load_64(_p0);
60 _br0 = MC2_branchUsesID(_mn, 1, 2, true);
62 } else { _br0 = MC2_branchUsesID(_mn, 0, 2, true); MC2_merge(_br0);
65 void * _p1 = &n->data;
66 MCID _fn1 = MC2_function(1, MC2_PTR_LENGTH, (uint64_t)_p1, _mn); _mdata=MC2_nextOpLoad(_fn1); int data = load_64(_p1);
75 void thread(unsigned thread_index)
78 for (int i = 0; i < 40; i++) {
80 if (0 == thread_index)
82 _br1 = MC2_branchUsesID(MCID_NODEP, 1, 2, true);
83 q->enqueue(MCID_NODEP, 11);
88 _br1 = MC2_branchUsesID(MCID_NODEP, 0, 2, true);
90 // RL_ASSERT(11 == d);
98 int user_main(int argc, char **argv)
102 q = new spsc_queue();
104 thrd_create(&A, (thrd_start_t)&thread, (void *)0);
105 thrd_create(&B, (thrd_start_t)&thread, (void *)1);