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.*/
18 /** @brief A graph of Model Actions for tracking cycles. */
23 void addEdge(const ModelAction *from, const ModelAction *to);
24 bool checkForCycles();
25 bool checkForRMWViolation();
26 void addRMWEdge(const ModelAction *from, const ModelAction *rmw);
27 bool checkPromise(const ModelAction *from, Promise *p);
28 bool checkReachable(const ModelAction *from, const ModelAction *to);
31 void rollbackChanges();
32 #if SUPPORT_MOD_ORDER_DUMP
33 void dumpNodes(FILE *file);
34 void dumpGraphToFile(const char * filename);
39 CycleNode * getNode(const ModelAction *);
41 /** @brief A table for mapping ModelActions to CycleNodes */
42 HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
43 #if SUPPORT_MOD_ORDER_DUMP
44 std::vector<CycleNode *> nodeList;
47 bool checkReachable(CycleNode *from, CycleNode *to);
49 /** @brief A flag: true if this graph contains cycles */
56 std::vector<CycleNode *> rollbackvector;
57 std::vector<CycleNode *> rmwrollbackvector;
60 /** @brief A node within a CycleGraph; corresponds to one ModelAction */
63 CycleNode(const ModelAction *action);
64 bool addEdge(CycleNode * node);
65 std::vector<CycleNode *> * getEdges();
66 bool setRMW(CycleNode *);
68 const ModelAction * getAction() {return action;};
79 /** @brief The ModelAction that this node represents */
80 const ModelAction *action;
82 /** @brief The edges leading out from this node */
83 std::vector<CycleNode *> edges;
85 /** Pointer to a RMW node that reads from this node, or NULL, if none