From dd1028f1a33deab855739112b3fc78663524455e Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 9 Jan 2013 15:26:47 -0800 Subject: [PATCH] cyclegraph: detect cycles immediately Previously, we have used a special case in CycleGraph to delay detection of a mo-cycle (actually, an RMW atomicity violation) long enough so that a RMW can "reorder" across another RMW by passing its future value. Unfortunately, this only works some of the time, as the execution *may or may not* be a feasible prefix which allows the sending of the future value. Instead, we need to pull this special case out of CycleGraph and (in subsequent commits) will add a more proper solution in model.cc. --- cyclegraph.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cyclegraph.cc b/cyclegraph.cc index 9a51195..66f9f69 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -68,18 +68,12 @@ void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) if (fromnode->addEdge(tonode)) rollbackvector.push_back(fromnode); - - CycleNode *rmwnode = fromnode->getRMW(); - /* * If the fromnode has a rmwnode that is not the tonode, we should add * an edge between its rmwnode and the tonode - * - * If tonode is also a rmw, don't do this check as the execution is - * doomed and we'll catch the problem elsewhere, but we want to allow - * for the possibility of sending to's write value to rmwnode */ - if (rmwnode != NULL && !to->is_rmw()) { + CycleNode *rmwnode = fromnode->getRMW(); + if (rmwnode && rmwnode != tonode) { if (!hasCycles) hasCycles = checkReachable(tonode, rmwnode); -- 2.34.1