cyclegraph: add Promise CycleNode
authorBrian Norris <banorris@uci.edu>
Sat, 26 Jan 2013 01:19:55 +0000 (17:19 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 6 Feb 2013 21:44:38 +0000 (13:44 -0800)
A very bare-bones constructor.

cyclegraph.cc
cyclegraph.h

index 00b8cd85731800fcdfb3593147d2bbd5bd84ace4..7a3532830598684a7719f6f3329fcda746aa5ccc 100644 (file)
@@ -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)
 {
 }
index 8efd5d416ff05e2b372d2eae183d0686d704d36e..f7b346c1f062c6b8932908b552144829f070b2d8 100644 (file)
@@ -60,10 +60,14 @@ class CycleGraph {
        std::vector< CycleNode *, SnapshotAlloc<CycleNode *> > 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<CycleNode *> > edges;