move work_list (thrd_func_list) from history.h to execution.h, and fix the memory...
[c11tester.git] / funcnode.h
index 03c92ef01a94f8b235257cc7c1f99924dda8c183..6ddcbb26d328859ddc2a8a42716ecee5ff935958 100644 (file)
@@ -3,19 +3,24 @@
 
 class ModelAction;
 
-typedef ModelList<const ModelAction *> action_mlist_t;
-typedef SnapList<uint32_t> func_id_list_t;
+typedef ModelList<FuncInst *> func_inst_list_t;
 
 class FuncInst {
-public: 
+public:
        FuncInst(ModelAction *act);
        ~FuncInst();
 
-       ModelAction * get_action() const { return action; }
+       //ModelAction * get_action() const { return action; }
        const char * get_position() const { return position; }
+       void * get_location() const { return location; }
+       action_type get_type() const { return type; }
+
+       MEMALLOC
 private:
-       ModelAction * const action;
+       //ModelAction * const action;
        const char * position;
+       void *location;
+       action_type type;
 };
 
 class FuncNode {
@@ -23,8 +28,19 @@ public:
        FuncNode();
        ~FuncNode();
 
-       HashTable<const char *, FuncInst *, uintptr_t, 4> * getFuncInsts() { return &func_insts; }
+       void add_action(ModelAction *act);
+
+       HashTable<const char *, FuncInst *, uintptr_t, 4, model_malloc, model_calloc, model_free> * getFuncInsts() { return &func_insts; }
+       func_inst_list_t * get_inst_list() { return &inst_list; }
+
+       MEMALLOC
 private:
-       HashTable<const char *, FuncInst *, uintptr_t, 4> func_insts;
-};
+       /* Use source line number as the key of hashtable
+        *
+        * To do: cds_atomic_compare_exchange contains three atomic operations
+        * that are feeded with the same source line number by llvm pass
+        */
+       HashTable<const char *, FuncInst *, uintptr_t, 4, model_malloc, model_calloc, model_free> func_insts;
 
+       func_inst_list_t inst_list;
+};