X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=cyclegraph.cc;h=44f5a28bc15b69cc3289a4906b298341845ae324;hp=e0b221514f9bd88b0785839b44e2436921f9f4b8;hb=f09f0fed35af38da74497923a910ab8043405016;hpb=a482ef2b49ff9bcae7a6898585409181bce3f02a diff --git a/cyclegraph.cc b/cyclegraph.cc index e0b22151..44f5a28b 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -308,10 +308,11 @@ bool CycleGraph::addEdge(const T *from, const U *to) return addNodeEdge(fromnode, tonode); } -/* Instantiate three forms of CycleGraph::addEdge */ +/* Instantiate four forms of CycleGraph::addEdge */ template bool CycleGraph::addEdge(const ModelAction *from, const ModelAction *to); template bool CycleGraph::addEdge(const ModelAction *from, const Promise *to); template bool CycleGraph::addEdge(const Promise *from, const ModelAction *to); +template bool CycleGraph::addEdge(const Promise *from, const Promise *to); #if SUPPORT_MOD_ORDER_DUMP @@ -405,13 +406,13 @@ bool CycleGraph::checkReachable(const CycleNode *from, const CycleNode *to) cons } /** - * Checks whether one ModelAction can reach another ModelAction/Promise - * @param from The ModelAction from which to begin exploration + * Checks whether one ModelAction/Promise can reach another ModelAction/Promise + * @param from The ModelAction or Promise from which to begin exploration * @param to The ModelAction or Promise to reach * @return True, @a from can reach @a to; otherwise, false */ -template -bool CycleGraph::checkReachable(const ModelAction *from, const T *to) const +template +bool CycleGraph::checkReachable(const T *from, const U *to) const { CycleNode *fromnode = getNode_noCreate(from); CycleNode *tonode = getNode_noCreate(to); @@ -421,11 +422,13 @@ bool CycleGraph::checkReachable(const ModelAction *from, const T *to) const return checkReachable(fromnode, tonode); } -/* Instantiate two forms of CycleGraph::checkReachable */ +/* Instantiate three forms of CycleGraph::checkReachable */ template bool CycleGraph::checkReachable(const ModelAction *from, const ModelAction *to) const; template bool CycleGraph::checkReachable(const ModelAction *from, const Promise *to) const; +template bool CycleGraph::checkReachable(const Promise *from, + const ModelAction *to) const; /** @return True, if the promise has failed; false otherwise */ bool CycleGraph::checkPromise(const ModelAction *fromact, Promise *promise) const @@ -440,6 +443,8 @@ bool CycleGraph::checkPromise(const ModelAction *fromact, Promise *promise) cons CycleNode *node = queue.back(); queue.pop_back(); + if (node->getPromise() == promise) + return true; if (!node->is_promise() && promise->eliminate_thread(node->getAction()->get_tid())) return true;