X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=cyclegraph.h;h=624ce885f2aadf4543dd9505b40a4192ceb802aa;hp=fefe34401c15038484bd44389b4da44a80cc56ec;hb=15162a2ac08b0a6b06e5319a7424055f4d12e01c;hpb=2a59ba5a8cb2db9eb9bc7403d3459d70e74fc635 diff --git a/cyclegraph.h b/cyclegraph.h index fefe3440..624ce885 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -23,58 +23,33 @@ class CycleGraph { public: CycleGraph(); ~CycleGraph(); + void addEdge(const ModelAction *from, const ModelAction *to); + void addRMWEdge(const ModelAction *from, const ModelAction *rmw); + bool checkReachable(const ModelAction *from, const ModelAction *to) const; - template - bool addEdge(const T *from, const U *to); - - template - void addRMWEdge(const T *from, const ModelAction *rmw); - - bool checkForCycles() const; - - template - bool checkReachable(const T *from, const U *to) const; - - void startChanges(); - void commitChanges(); - void rollbackChanges(); #if SUPPORT_MOD_ORDER_DUMP void dumpNodes(FILE *file) const; void dumpGraphToFile(const char *filename) const; - void dot_print_node(FILE *file, const ModelAction *act); - template - void dot_print_edge(FILE *file, const T *from, const U *to, const char *prop); + void dot_print_edge(FILE *file, const ModelAction *from, const ModelAction *to, const char *prop); #endif - CycleNode * getNode_noCreate(const ModelAction *act) const; + CycleNode * getNode_noCreate(const ModelAction *act) const; SNAPSHOTALLOC private: - bool addNodeEdge(CycleNode *fromnode, CycleNode *tonode); + void addNodeEdge(CycleNode *fromnode, CycleNode *tonode); void putNode(const ModelAction *act, CycleNode *node); CycleNode * getNode(const ModelAction *act); - bool mergeNodes(CycleNode *node1, CycleNode *node2); - - HashTable *discovered; - ModelVector * queue; - /** @brief A table for mapping ModelActions to CycleNodes */ HashTable actionToNode; + SnapVector * queue; #if SUPPORT_MOD_ORDER_DUMP SnapVector nodeList; #endif bool checkReachable(const CycleNode *from, const CycleNode *to) const; - - /** @brief A flag: true if this graph contains cycles */ - bool hasCycles; - /** @brief The previous value of CycleGraph::hasCycles, for rollback */ - bool oldCycles; - - SnapVector rollbackvector; - SnapVector rmwrollbackvector; }; /** @@ -83,11 +58,10 @@ private: class CycleNode { public: CycleNode(const ModelAction *act); - bool addEdge(CycleNode *node); + void addEdge(CycleNode *node); CycleNode * getEdge(unsigned int i) const; unsigned int getNumEdges() const; CycleNode * removeEdge(); - bool setRMW(CycleNode *); CycleNode * getRMW() const; void clearRMW() { hasRMW = NULL; } @@ -104,6 +78,10 @@ private: /** Pointer to a RMW node that reads from this node, or NULL, if none * exists */ CycleNode *hasRMW; + + /** ClockVector for this Node. */ + ClockVector *cv; + friend class CycleGraph; }; #endif /* __CYCLEGRAPH_H__ */