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 dumpGraphToFile(const char * filename);
37 CycleNode * getNode(const ModelAction *);
39 /** @brief A table for mapping ModelActions to CycleNodes */
40 HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
41 #if SUPPORT_MOD_ORDER_DUMP
42 std::vector<CycleNode *> nodeList;
45 bool checkReachable(CycleNode *from, CycleNode *to);
47 /** @brief A flag: true if this graph contains cycles */
54 std::vector<CycleNode *> rollbackvector;
55 std::vector<CycleNode *> rmwrollbackvector;
58 /** @brief A node within a CycleGraph; corresponds to one ModelAction */
61 CycleNode(const ModelAction *action);
62 bool addEdge(CycleNode * node);
63 std::vector<CycleNode *> * getEdges();
64 bool setRMW(CycleNode *);
66 const ModelAction * getAction() {return action;};
77 /** @brief The ModelAction that this node represents */
78 const ModelAction *action;
80 /** @brief The edges leading out from this node */
81 std::vector<CycleNode *> edges;
83 /** Pointer to a RMW node that reads from this node, or NULL, if none