cyclegraph: detect cycles immediately
authorBrian Norris <banorris@uci.edu>
Wed, 9 Jan 2013 23:26:47 +0000 (15:26 -0800)
committerBrian Norris <banorris@uci.edu>
Thu, 24 Jan 2013 20:29:10 +0000 (12:29 -0800)
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

index 9a511952b0826470befc1a2bcc7ecde85619265c..66f9f69548608d02baa36dbd09bbd9b8ac2feac7 100644 (file)
@@ -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);