+ /* This process should not add a cycle because either:
+ * (1) The rmw should not have any incoming edges yet if it is the
+ * new node or
+ * (2) the fromnode is the new node and therefore it should not
+ * have any outgoing edges.
+ */
+ for (unsigned int i = 0; i < fromnode->getNumEdges(); i++) {
+ CycleNode *tonode = fromnode->getEdge(i);
+ if (tonode != rmwnode) {
+ if (rmwnode->addEdge(tonode))
+ rollbackvector.push_back(rmwnode);
+ }
+ }
+
+
+ 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..
+ hasCycles = checkReachable(rmwnode, fromnode);
+ }
+ if (fromnode->addEdge(rmwnode))
+ rollbackvector.push_back(fromnode);
+}
+
+#if SUPPORT_MOD_ORDER_DUMP
+void CycleGraph::dumpNodes(FILE *file)
+{
+ for (unsigned int i = 0; i < nodeList.size(); i++) {
+ CycleNode *cn = nodeList[i];
+ const ModelAction *action = cn->getAction();
+ fprintf(file, "N%u [label=\"%u, T%u\"];\n",action->get_seq_number(),action->get_seq_number(), action->get_tid());
+ if (cn->getRMW() != NULL) {
+ fprintf(file, "N%u -> N%u[style=dotted];\n", action->get_seq_number(), cn->getRMW()->getAction()->get_seq_number());
+ }
+ for (unsigned int j = 0; j < cn->getNumEdges(); j++) {
+ CycleNode *dst = cn->getEdge(j);
+ const ModelAction *dstaction = dst->getAction();
+ fprintf(file, "N%u -> N%u;\n", action->get_seq_number(), dstaction->get_seq_number());
+ }