X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=cyclegraph.h;h=556af1cfdd04627c8b9a5d70d05c3078b01c3469;hp=25401d9a3d349d07f6c4b11fe4a140e041f82394;hb=f750120c93252f2b677c4b07d003fc71fcdaaa00;hpb=0dc4895e7c40b9588d5ece94cba09e2fe2af420d diff --git a/cyclegraph.h b/cyclegraph.h index 25401d9a..556af1cf 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -9,19 +9,14 @@ #ifndef __CYCLEGRAPH_H__ #define __CYCLEGRAPH_H__ -#include #include #include #include "hashtable.h" #include "config.h" #include "mymemory.h" - -class Promise; -class CycleNode; -class ModelAction; - -typedef std::vector< const Promise *, ModelAlloc > promise_list_t; +#include "stl-model.h" +#include "classlist.h" /** @brief A graph of Model Actions for tracking cycles. */ class CycleGraph { @@ -36,7 +31,6 @@ class CycleGraph { void addRMWEdge(const T *from, const ModelAction *rmw); bool checkForCycles() const; - bool checkPromise(const ModelAction *from, Promise *p) const; template bool checkReachable(const T *from, const U *to) const; @@ -52,52 +46,43 @@ class CycleGraph { template void dot_print_edge(FILE *file, const T *from, const U *to, const char *prop); #endif - - bool resolvePromise(const Promise *promise, ModelAction *writer); + CycleNode * getNode_noCreate(const ModelAction *act) const; SNAPSHOTALLOC private: bool addNodeEdge(CycleNode *fromnode, CycleNode *tonode); void putNode(const ModelAction *act, CycleNode *node); - void putNode(const Promise *promise, CycleNode *node); - void erasePromiseNode(const Promise *promise); CycleNode * getNode(const ModelAction *act); - CycleNode * getNode(const Promise *promise); - CycleNode * getNode_noCreate(const ModelAction *act) const; - CycleNode * getNode_noCreate(const Promise *promise) const; bool mergeNodes(CycleNode *node1, CycleNode *node2); HashTable *discovered; - std::vector< const CycleNode *, ModelAlloc > * queue; + ModelVector * queue; /** @brief A table for mapping ModelActions to CycleNodes */ HashTable actionToNode; - /** @brief A table for mapping Promises to CycleNodes */ - HashTable promiseToNode; #if SUPPORT_MOD_ORDER_DUMP - std::vector< CycleNode *, SnapshotAlloc > nodeList; + 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; - std::vector< CycleNode *, SnapshotAlloc > rollbackvector; - std::vector< CycleNode *, SnapshotAlloc > rmwrollbackvector; + SnapVector rollbackvector; + SnapVector rmwrollbackvector; }; /** - * @brief A node within a CycleGraph; corresponds either to one ModelAction or - * to a promised future value + * @brief A node within a CycleGraph; corresponds either to one ModelAction */ class CycleNode { public: CycleNode(const ModelAction *act); - CycleNode(const Promise *promise); bool addEdge(CycleNode *node); CycleNode * getEdge(unsigned int i) const; unsigned int getNumEdges() const; @@ -110,24 +95,17 @@ class CycleNode { CycleNode * getRMW() const; void clearRMW() { hasRMW = NULL; } const ModelAction * getAction() const { return action; } - const Promise * getPromise() const { return promise; } - bool is_promise() const { return !action; } - void resolvePromise(const ModelAction *writer); SNAPSHOTALLOC private: /** @brief The ModelAction that this node represents */ const ModelAction *action; - /** @brief The promise represented by this node; only valid when action - * is NULL */ - const Promise *promise; - /** @brief The edges leading out from this node */ - std::vector< CycleNode *, SnapshotAlloc > edges; + SnapVector edges; /** @brief The edges leading into this node */ - std::vector< CycleNode *, SnapshotAlloc > back_edges; + SnapVector back_edges; /** Pointer to a RMW node that reads from this node, or NULL, if none * exists */