fix mutex_trylock bug
[c11tester.git] / funcinst.h
index fe4adb48313abb87ca5418628c6107c418183812..c4d41eec32fb69211e11a6c84f36299335857a84 100644 (file)
@@ -2,9 +2,9 @@
 #define __FUNCINST_H__
 
 #include "action.h"
+#include "classlist.h"
 #include "hashtable.h"
-
-class ModelAction;
+#include "threads-model.h"
 
 typedef ModelList<FuncInst *> func_inst_list_mt;
 
@@ -25,8 +25,8 @@ public:
        bool add_pred(FuncInst * other);
        bool add_succ(FuncInst * other);
 
-       //FuncInst * search_in_collision(ModelAction *act);
-       //func_inst_list_mt * get_collisions() { return &collisions; }
+       FuncInst * search_in_collision(ModelAction *act);
+       void add_to_collision(FuncInst * inst);
 
        func_inst_list_mt * get_preds() { return &predecessors; }
        func_inst_list_mt * get_succs() { return &successors; }
@@ -39,8 +39,8 @@ public:
        void set_execution_number(int new_number) { execution_number = new_number; }
        int get_execution_number() { return execution_number; }
 
-       void set_associated_act(ModelAction * act, uint32_t marker);
-       ModelAction * get_associated_act(uint32_t marker);
+       void set_associated_read(thread_id_t tid, int index, uint32_t marker, uint64_t read_val);
+       uint64_t get_associated_read(thread_id_t tid, int index, uint32_t marker);
 
        void print();
 
@@ -49,7 +49,7 @@ private:
        const char * position;
 
        /* Atomic operations with the same source line number may act at different
-        * memory locations, such as the next field of the head pointer in ms-queue. 
+        * memory locations, such as the next field of the head pointer in ms-queue.
         * location only stores the memory location when this FuncInst was constructed.
         */
        void * location;
@@ -64,15 +64,16 @@ private:
        bool single_location;
        int execution_number;
 
-       ModelAction * associated_act;
-       uint32_t marker;
+       ModelVector< ModelVector<uint64_t> * > associated_reads;
+       ModelVector< ModelVector<uint32_t> * > thrd_markers;
 
-       /* Currently not in use. May remove this field later
-        *
-        * collisions store a list of FuncInsts with the same position
-        * but different action types. For example, CAS is broken down
-        * as three different atomic operations in cmodelint.cc */
-       // func_inst_list_mt collisions;
+       /**
+        * Collisions store a list of FuncInsts with the same position
+        * but different action types. For example,
+        * <code>volatile int x; x++;</code> produces read and write
+        * actions with the same position.
+        */
+       func_inst_list_mt collisions;
 
        func_inst_list_mt predecessors;
        func_inst_list_mt successors;