X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cyclegraph.h;h=a909c10b50a49f97453bf1f6114223400b11c4ac;hb=eb07120dfdbb206124f7857016a71b6ef0b9eb99;hp=8668077ed271cc887c7a249f470a8345c54d1539;hpb=c1372661a92b8d2ba3bc977ebbabf52127354bea;p=model-checker.git diff --git a/cyclegraph.h b/cyclegraph.h index 8668077..a909c10 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; @@ -57,38 +56,46 @@ 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; CycleNode * getBackEdge(unsigned int i) const; unsigned int getNumBackEdges() const; + CycleNode * removeEdge(); + CycleNode * removeBackEdge(); + 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;