From 29f99ad8eea3c32b435ddb009c2d20fee7a13df2 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 25 Jan 2013 17:19:55 -0800 Subject: [PATCH 1/1] cyclegraph: add Promise CycleNode A very bare-bones constructor. --- cyclegraph.cc | 12 ++++++++++++ cyclegraph.h | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) 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; -- 2.34.1