changes with lines of spec counted
[cdsspec-compiler.git] / benchmark / ms-queue / my_queue.h
index ce87b1d..ce6fd06 100644 (file)
@@ -49,16 +49,16 @@ void init_queue(queue_t *q, int num_threads);
                } tag_elem_t;
                
                @DeclareVar:
-               spec_list *__queue;
-               id_tag_t *tag;
+                       spec_list *__queue;
+                       id_tag_t *tag;
                @InitVar:
                        __queue = new_spec_list();
                        tag = new_id_tag(); // Beginning of available id
-               @Cleanup:
-                       if (__queue)
-                               free_spec_list(__queue);
-                       if (tag)
-                               free_id_tag(tag);
+               //@Cleanup:
+               //      if (__queue)
+               //              free_spec_list(__queue);
+               //      if (tag)
+               //              free_id_tag(tag);
                @DefineFunc:
                        tag_elem_t* new_tag_elem(call_id_t id, unsigned int data) {
                                tag_elem_t *e = (tag_elem_t*) CMODEL_MALLOC(sizeof(tag_elem_t));
@@ -66,25 +66,25 @@ void init_queue(queue_t *q, int num_threads);
                                e->data = data;
                                return e;
                        }
-               @DefineFunc:
-                       void free_tag_elem(tag_elem_t *e) {
-                               free(e);
-                       }
+               //@DefineFunc:
+               //      void free_tag_elem(tag_elem_t *e) {
+               //              free(e);
+               //      }
                @DefineFunc:
                        call_id_t get_id(void *wrapper) {
-                               if (wrapper == NULL)
-                                       return 0;
-                               return ((tag_elem_t*) wrapper)->id;
+               //              if (wrapper == NULL)
+               //                      return 0;
+               //              return ((tag_elem_t*) wrapper)->id;
+                               return wrapper == NULL ? 0 : ((tag_elem_t*) wrapper)->id;
                        }
                @DefineFunc:
                        unsigned int get_data(void *wrapper) {
                                return ((tag_elem_t*) wrapper)->data;
                        }
-       @Happens_before:
+       @Happens_before: Enqueue -> Dequeue
                # Only check the happens-before relationship according to the id of the
                # commit_point_set. For commit_point_set that has same ID, A -> B means
                # B happens after the previous A.
-               Enqueue -> Dequeue
        @End
 */
 
@@ -117,8 +117,7 @@ void enqueue(queue_t *q, unsigned int val);
                        pop_front(__queue);
                }
        //      model_print("Dequeue: __RET__=%d, retVal=%d, Old_Val=%d\n", __RET__, *retVal, _Old_Val);
-       @Post_check:
-               _Old_Val == 0 ? !__RET__ : _Old_Val == *retVal
+       @Post_check: _Old_Val == 0 ? !__RET__ : _Old_Val == *retVal
        @End
 */
 bool dequeue(queue_t *q, int *retVal);