separate out rmw actions
[c11tester.git] / cyclegraph.cc
index f519dac93b39975742887746f79a194e63dd12fe..2bac4de7cf0469c57818ceab835458a872bb7c29 100644 (file)
@@ -5,7 +5,9 @@
 /** Initializes a CycleGraph object. */
 CycleGraph::CycleGraph() :
        hasCycles(false),
-       oldCycles(false)
+       oldCycles(false),
+       hasRMWViolation(false),
+       oldRMWViolation(false)
 {
 }
 
@@ -77,7 +79,7 @@ void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) {
 
        /* Two RMW actions cannot read from the same write. */
        if (fromnode->setRMW(rmwnode)) {
-               hasCycles=true;
+               hasRMWViolation=true;
        } else {
                rmwrollbackvector.push_back(fromnode);
        }
@@ -144,6 +146,7 @@ void CycleGraph::startChanges() {
        ASSERT(rollbackvector.size()==0);
        ASSERT(rmwrollbackvector.size()==0);
        ASSERT(oldCycles==hasCycles);
+       ASSERT(oldRMWViolation==hasRMWViolation);
 }
 
 /** Commit changes to the cyclegraph. */
@@ -151,6 +154,7 @@ void CycleGraph::commitChanges() {
        rollbackvector.resize(0);
        rmwrollbackvector.resize(0);
        oldCycles=hasCycles;
+       oldRMWViolation=hasRMWViolation;
 }
 
 /** Rollback changes to the previous commit. */
@@ -164,6 +168,7 @@ void CycleGraph::rollbackChanges() {
        }
 
        hasCycles = oldCycles;
+       hasRMWViolation = oldRMWViolation;
        rollbackvector.resize(0);
        rmwrollbackvector.resize(0);
 }
@@ -173,6 +178,10 @@ bool CycleGraph::checkForCycles() {
        return hasCycles;
 }
 
+bool CycleGraph::checkForRMWViolation() {
+       return hasRMWViolation;
+}
+
 /**
  * Constructor for a CycleNode.
  * @param modelaction The ModelAction for this node