We need to represent edge addition as a low-level operation on
CycleNodes, not just on ModelActions.
CycleNode *fromnode = getNode(from);
CycleNode *tonode = getNode(to);
CycleNode *fromnode = getNode(from);
CycleNode *tonode = getNode(to);
+ addEdge(fromnode, tonode);
+}
+
+/**
+ * Adds an edge between two CycleNodes.
+ * @param fromnode The edge comes from this CycleNode
+ * @param tonode The edge points to this CycleNode
+ */
+void CycleGraph::addEdge(CycleNode *fromnode, CycleNode *tonode)
+{
if (!hasCycles)
hasCycles = checkReachable(tonode, fromnode);
if (!hasCycles)
hasCycles = checkReachable(tonode, fromnode);
- if (!hasCycles)
- hasCycles = checkReachable(rmwnode, fromnode);
-
- if (fromnode->addEdge(rmwnode))
- rollbackvector.push_back(fromnode);
+ addEdge(fromnode, rmwnode);
}
#if SUPPORT_MOD_ORDER_DUMP
}
#if SUPPORT_MOD_ORDER_DUMP
+ void addEdge(CycleNode *fromnode, CycleNode *tonode);
void putNode(const ModelAction *act, CycleNode *node);
CycleNode * getNode(const ModelAction *);
HashTable<const CycleNode *, const CycleNode *, uintptr_t, 4, model_malloc, model_calloc, model_free> *discovered;
void putNode(const ModelAction *act, CycleNode *node);
CycleNode * getNode(const ModelAction *);
HashTable<const CycleNode *, const CycleNode *, uintptr_t, 4, model_malloc, model_calloc, model_free> *discovered;