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.*/
15 /** @brief A graph of Model Actions for tracking cycles. */
20 void addEdge(const ModelAction *from, const ModelAction *to);
21 bool checkForCycles();
22 bool checkForRMWViolation();
23 void addRMWEdge(const ModelAction *from, const ModelAction *rmw);
25 bool checkReachable(const ModelAction *from, const ModelAction *to);
28 void rollbackChanges();
31 CycleNode * getNode(const ModelAction *);
33 /** @brief A table for mapping ModelActions to CycleNodes */
34 HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
36 bool checkReachable(CycleNode *from, CycleNode *to);
38 /** @brief A flag: true if this graph contains cycles */
45 std::vector<CycleNode *> rollbackvector;
46 std::vector<CycleNode *> rmwrollbackvector;
49 /** @brief A node within a CycleGraph; corresponds to one ModelAction */
52 CycleNode(const ModelAction *action);
53 void addEdge(CycleNode * node);
54 std::vector<CycleNode *> * getEdges();
55 bool setRMW(CycleNode *);
65 /** @brief The ModelAction that this node represents */
66 const ModelAction *action;
68 /** @brief The edges leading out from this node */
69 std::vector<CycleNode *> edges;
71 /** Pointer to a RMW node that reads from this node, or NULL, if none