1 /** @file cyclegraph.h @brief Data structure to track ordering
2 * constraints on modification order. The idea is to see whether a
3 * total order exists that satisfies the ordering constriants.*/
17 /** @brief A graph of Model Actions for tracking cycles. */
22 void addEdge(const ModelAction *from, const ModelAction *to);
23 bool checkForCycles();
24 bool checkForRMWViolation();
25 void addRMWEdge(const ModelAction *from, const ModelAction *rmw);
27 bool checkReachable(const ModelAction *from, const ModelAction *to);
30 void rollbackChanges();
31 #if SUPPORT_MOD_ORDER_DUMP
32 void dumpNodes(FILE *file);
33 void dumpGraphToFile(const char * filename);
38 CycleNode * getNode(const ModelAction *);
40 /** @brief A table for mapping ModelActions to CycleNodes */
41 HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
42 #if SUPPORT_MOD_ORDER_DUMP
43 std::vector<CycleNode *> nodeList;
46 bool checkReachable(CycleNode *from, CycleNode *to);
48 /** @brief A flag: true if this graph contains cycles */
55 std::vector<CycleNode *> rollbackvector;
56 std::vector<CycleNode *> rmwrollbackvector;
59 /** @brief A node within a CycleGraph; corresponds to one ModelAction */
62 CycleNode(const ModelAction *action);
63 bool addEdge(CycleNode * node);
64 std::vector<CycleNode *> * getEdges();
65 bool setRMW(CycleNode *);
67 const ModelAction * getAction() {return action;};
78 /** @brief The ModelAction that this node represents */
79 const ModelAction *action;
81 /** @brief The edges leading out from this node */
82 std::vector<CycleNode *> edges;
84 /** Pointer to a RMW node that reads from this node, or NULL, if none