changes to the spec of deque
[cdsspec-compiler.git] / benchmark / chase-lev-deque-bugfix / deque.h
index 6bb4698fee6480f95152f51e53bd8617c2176cdd..7d2df9f18e1732d7e2909cf5ec89faaa7b9afd0b 100644 (file)
@@ -47,11 +47,17 @@ typedef struct {
             }
         @DefineFunc:
             call_id_t get_id(void *wrapper) {
-                return ((tag_elem_t*) wrapper)->id;
+                               tag_elem_t *res = (tag_elem_t*) wrapper;
+                               if (res == NULL) {
+                                       //model_print("wrong id here\n");
+                                       return 0;
+                               }
+                return res->id;
             }
         @DefineFunc:
             int get_data(void *wrapper) {
-                return ((tag_elem_t*) wrapper)->data;
+                               tag_elem_t *res = (tag_elem_t*) wrapper;
+                return res->data;
             }
     @Happens_before:
         Push -> Steal
@@ -66,7 +72,8 @@ void resize(Deque *q);
 /**
     @Begin
     @Interface: Take 
-    @Commit_point_set: Take_Point1 | Take_Point2 | Take_Point3
+    //@Commit_point_set: Take_Read_Bottom | Take_CAS_Top | Take_Additional_Point
+    @Commit_point_set: Take_Read_Bottom | Take_Additional_Point
     @ID: __RET__ == EMPTY ? DEFAULT_CALL_ID : get_id(back(__deque))
     @Action:
         int _Old_Val = EMPTY;
@@ -85,7 +92,7 @@ int take(Deque *q);
 /**
     @Begin
     @Interface: Push 
-    @Commit_point_set: Push_Point
+    @Commit_point_set: Push_Update_Bottom 
     @ID: get_and_inc(tag);
     @Action:
         tag_elem_t *elem = new_tag_elem(__ID__, x);
@@ -97,7 +104,8 @@ void push(Deque *q, int x);
 /**
     @Begin
     @Interface: Steal 
-    @Commit_point_set: Steal_Point1 | Steal_Point2 | Steal_Point3
+    //@Commit_point_set: Steal_Read_Bottom | Steal_CAS_Top | Steal_Additional_Point
+    @Commit_point_set: Steal_Read_Bottom | Steal_Additional_Point
     @ID: (__RET__ == EMPTY || __RET__ == ABORT) ? DEFAULT_CALL_ID : get_id(front(__deque))
     @Action:
         int _Old_Val = EMPTY;