The cyclegraph shouldn't fail (i.e., ASSERT()) when reflexive edges are
added; instead, they should be declared as cycles.
void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) {
ASSERT(from);
ASSERT(to);
void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) {
ASSERT(from);
ASSERT(to);
CycleNode *fromnode=getNode(from);
CycleNode *tonode=getNode(to);
CycleNode *fromnode=getNode(from);
CycleNode *tonode=getNode(to);
+ if (!hasCycles) {
+ // Reflexive edges are cycles
+ hasCycles = (from == to);
+ }
if (!hasCycles) {
// Check for Cycles
hasCycles=checkReachable(tonode, fromnode);
if (!hasCycles) {
// Check for Cycles
hasCycles=checkReachable(tonode, fromnode);
void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) {
ASSERT(from);
ASSERT(rmw);
void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) {
ASSERT(from);
ASSERT(rmw);
CycleNode *fromnode=getNode(from);
CycleNode *rmwnode=getNode(rmw);
CycleNode *fromnode=getNode(from);
CycleNode *rmwnode=getNode(rmw);
+ if (!hasCycles) {
+ // Reflexive edges are cycles
+ hasCycles = (from == rmw);
+ }
if (!hasCycles) {
// With promises we could be setting up a cycle here if we aren't
// careful...avoid it..
if (!hasCycles) {
// With promises we could be setting up a cycle here if we aren't
// careful...avoid it..