X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=cyclegraph.h;h=f7b346c1f062c6b8932908b552144829f070b2d8;hp=45e49fb7bec3950656054e02f92b06aa5cf3ae65;hb=29f99ad8eea3c32b435ddb009c2d20fee7a13df2;hpb=bd6db524d36605b8eae0159f943b7e9e9361d7a5 diff --git a/cyclegraph.h b/cyclegraph.h index 45e49fb7..f7b346c1 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -26,7 +26,6 @@ class CycleGraph { ~CycleGraph(); void addEdge(const ModelAction *from, const ModelAction *to); bool checkForCycles() const; - bool checkForRMWViolation() const; void addRMWEdge(const ModelAction *from, const ModelAction *rmw); bool checkPromise(const ModelAction *from, Promise *p) const; bool checkReachable(const ModelAction *from, const ModelAction *to) const; @@ -40,6 +39,7 @@ class CycleGraph { SNAPSHOTALLOC private: + void addEdge(CycleNode *fromnode, CycleNode *tonode); void putNode(const ModelAction *act, CycleNode *node); CycleNode * getNode(const ModelAction *); HashTable *discovered; @@ -56,17 +56,18 @@ class CycleGraph { bool hasCycles; bool oldCycles; - bool hasRMWViolation; - bool oldRMWViolation; - std::vector< CycleNode *, SnapshotAlloc > rollbackvector; std::vector< CycleNode *, SnapshotAlloc > rmwrollbackvector; }; -/** @brief A node within a CycleGraph; corresponds to one ModelAction */ +/** + * @brief A node within a CycleGraph; corresponds either to one ModelAction or + * to a promised future value + */ 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; @@ -74,20 +75,24 @@ class CycleNode { unsigned int getNumBackEdges() const; bool setRMW(CycleNode *); CycleNode * getRMW() const; + void clearRMW() { hasRMW = NULL; } const ModelAction * getAction() const { return action; } void popEdge() { edges.pop_back(); } - void clearRMW() { - hasRMW = NULL; - } + + bool is_promise() const { return !action; } 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;