//If the fromnode has a rmwnode that is not the tonode, we
//should add an edge between its rmwnode and the tonode
- if (rmwnode!=NULL&&rmwnode!=tonode) {
+ //If tonode is also a rmw, don't do this check as the execution is
+ //doomed and we'll catch the problem elsewhere, but we want to allow
+ //for the possibility of sending to's write value to rmwnode
+
+ if (rmwnode!=NULL&&!to->is_rmw()) {
if (!hasCycles) {
// Check for Cycles
hasCycles=checkReachable(tonode, rmwnode);
}
/* Transfer all outgoing edges from the from node to the rmw node */
- /* This process should not add a cycle because either:
+ /* 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
+ * (2) the fromnode is the new node and therefore it should not
* have any outgoing edges.
*/
std::vector<CycleNode *> * edges=fromnode->getEdges();
for(unsigned int i=0;i<edges->size();i++) {
CycleNode * tonode=(*edges)[i];
- rollbackvector.push_back(rmwnode);
- rmwnode->addEdge(tonode);
+ if (tonode!=rmwnode) {
+ rollbackvector.push_back(rmwnode);
+ rmwnode->addEdge(tonode);
+ }
}
rollbackvector.push_back(fromnode);