From: Brian Norris Date: Fri, 1 Feb 2013 23:09:07 +0000 (-0800) Subject: cyclegraph: add CycleNode::resolvePromise(), CycleNode::getPromise() X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=5467ad92b9043ee54e3c64d661277751c43a355f cyclegraph: add CycleNode::resolvePromise(), CycleNode::getPromise() --- diff --git a/cyclegraph.cc b/cyclegraph.cc index 58cb79f2..479ddf85 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -429,3 +429,19 @@ bool CycleNode::setRMW(CycleNode *node) 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()); +} diff --git a/cyclegraph.h b/cyclegraph.h index 4a3d083d..e7e9380b 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -89,12 +89,14 @@ class CycleNode { 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 resolvePromise(const ModelAction *writer); SNAPSHOTALLOC private: