cyclegraph: add CycleNode::resolvePromise(), CycleNode::getPromise()
authorBrian Norris <banorris@uci.edu>
Fri, 1 Feb 2013 23:09:07 +0000 (15:09 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 6 Feb 2013 21:44:38 +0000 (13:44 -0800)
cyclegraph.cc
cyclegraph.h

index 58cb79f22cdd573acf59e24976014c91731e6e7e..479ddf852fcc0440f1f0850867fca5dd87ddfab3 100644 (file)
@@ -429,3 +429,19 @@ bool CycleNode::setRMW(CycleNode *node)
        hasRMW = node;
        return false;
 }
        hasRMW = node;
        return false;
 }
+
+/**
+ * Convert a Promise CycleNode into a concrete-valued CycleNode. Should only be
+ * used when there's no existing ModelAction CycleNode for this write.
+ *
+ * @param writer The ModelAction which wrote the future value represented by
+ * this CycleNode
+ */
+void CycleNode::resolvePromise(const ModelAction *writer)
+{
+       ASSERT(is_promise());
+       ASSERT(promise->is_compatible(writer));
+       action = writer;
+       promise = NULL;
+       ASSERT(!is_promise());
+}
index 4a3d083d13c19fb897a29ebe2917af04f0990423..e7e9380bb7e67e195d3d2ab95b587a44aa0234aa 100644 (file)
@@ -89,12 +89,14 @@ class CycleNode {
        CycleNode * getRMW() const;
        void clearRMW() { hasRMW = NULL; }
        const ModelAction * getAction() const { return action; }
        CycleNode * getRMW() const;
        void clearRMW() { hasRMW = NULL; }
        const ModelAction * getAction() const { return action; }
+       const Promise * getPromise() const { return promise; }
 
        void popEdge() {
                edges.pop_back();
        }
 
        bool is_promise() const { return !action; }
 
        void popEdge() {
                edges.pop_back();
        }
 
        bool is_promise() const { return !action; }
+       void resolvePromise(const ModelAction *writer);
 
        SNAPSHOTALLOC
  private:
 
        SNAPSHOTALLOC
  private: