From: Brian Norris Date: Sat, 26 Jan 2013 01:19:55 +0000 (-0800) Subject: cyclegraph: add Promise CycleNode X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=29f99ad8eea3c32b435ddb009c2d20fee7a13df2 cyclegraph: add Promise CycleNode A very bare-bones constructor. --- diff --git a/cyclegraph.cc b/cyclegraph.cc index 00b8cd85..7a353283 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -279,6 +279,18 @@ bool CycleGraph::checkForCycles() const */ CycleNode::CycleNode(const ModelAction *act) : action(act), + promise(NULL), + hasRMW(NULL) +{ +} + +/** + * @brief Constructor for a Promise CycleNode + * @param promise The Promise which was generated + */ +CycleNode::CycleNode(const Promise *promise) : + action(NULL), + promise(promise), hasRMW(NULL) { } diff --git a/cyclegraph.h b/cyclegraph.h index 8efd5d41..f7b346c1 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -60,10 +60,14 @@ class CycleGraph { 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; @@ -78,11 +82,17 @@ class CycleNode { edges.pop_back(); } + 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;