CycleGraph::CycleGraph() :
discovered(new HashTable<const CycleNode *, const CycleNode *, uintptr_t, 4, model_malloc, model_calloc, model_free>(16)),
hasCycles(false),
- oldCycles(false),
- hasRMWViolation(false),
- oldRMWViolation(false)
+ oldCycles(false)
{
}
CycleNode *rmwnode = getNode(rmw);
/* Two RMW actions cannot read from the same write. */
- if (fromnode->setRMW(rmwnode)) {
- hasRMWViolation = true;
- } else {
+ if (fromnode->setRMW(rmwnode))
+ hasCycles = true;
+ else
rmwrollbackvector.push_back(fromnode);
- }
/* Transfer all outgoing edges from the from node to the rmw node */
/* This process should not add a cycle because either:
ASSERT(rollbackvector.size() == 0);
ASSERT(rmwrollbackvector.size() == 0);
ASSERT(oldCycles == hasCycles);
- ASSERT(oldRMWViolation == hasRMWViolation);
}
/** Commit changes to the cyclegraph. */
rollbackvector.resize(0);
rmwrollbackvector.resize(0);
oldCycles = hasCycles;
- oldRMWViolation = hasRMWViolation;
}
/** Rollback changes to the previous commit. */
}
hasCycles = oldCycles;
- hasRMWViolation = oldRMWViolation;
rollbackvector.resize(0);
rmwrollbackvector.resize(0);
}
return hasCycles;
}
-bool CycleGraph::checkForRMWViolation() const
-{
- return hasRMWViolation;
-}
-
/**
* @brief Constructor for a CycleNode
* @param act The ModelAction for this node