addNodeEdge(fromnode, rmwnode, true);
}
+void CycleGraph::addEdges(SnapList<ModelAction *> * edgeset, const ModelAction *to) {
+ for(SnapList<ModelAction*>::iterator it = edgeset->begin();it!=edgeset->end();) {
+ ModelAction *act = *it;
+ CycleNode *node = getNode(act);
+ SnapList<ModelAction*>::iterator it2 = it;
+ it2++;
+ for(;it2!=edgeset->end(); ) {
+ ModelAction *act2 = *it;
+ CycleNode *node2 = getNode(act2);
+ if (checkReachable(node, node2)) {
+ it = edgeset->erase(it);
+ goto endouterloop;
+ } else if (checkReachable(node2, node)) {
+ it2 = edgeset->erase(it2);
+ goto endinnerloop;
+ }
+ it2++;
+endinnerloop:
+ ;
+ }
+ it++;
+endouterloop:
+ ;
+ }
+ for(SnapList<ModelAction*>::iterator it = edgeset->begin();it!=edgeset->end();it++) {
+ ModelAction *from = *it;
+ addEdge(from, to, from->get_tid() == to->get_tid());
+ }
+}
+
/**
* @brief Adds an edge between objects
*
public:
CycleGraph();
~CycleGraph();
+ void addEdges(SnapList<ModelAction *> * edgeset, const ModelAction *to);
void addEdge(const ModelAction *from, const ModelAction *to);
void addEdge(const ModelAction *from, const ModelAction *to, bool forceedge);
void addRMWEdge(const ModelAction *from, const ModelAction *rmw);
unsigned int i;
ASSERT(curr->is_write());
+ SnapList<ModelAction *> edgeset;
+
if (curr->is_seqcst()) {
/* We have to at least see the last sequentially consistent write,
so we are initialized. */
ModelAction *last_seq_cst = get_last_seq_cst_write(curr);
if (last_seq_cst != NULL) {
- mo_graph->addEdge(last_seq_cst, curr);
+ edgeset.push_back(last_seq_cst);
}
}
/* Iterate over actions in thread, starting from most recent */
action_list_t *list = &(*thrd_lists)[i];
action_list_t::reverse_iterator rit;
- bool force_edge = false;
for (rit = list->rbegin();rit != list->rend();rit++) {
ModelAction *act = *rit;
if (act == curr) {
* 3) If normal write, we need to look at earlier actions, so
* continue processing list.
*/
- force_edge = true;
if (curr->is_rmw()) {
if (curr->get_reads_from() != NULL)
break;
/* C++, Section 29.3 statement 7 */
if (last_sc_fence_thread_before && act->is_write() &&
*act < *last_sc_fence_thread_before) {
- mo_graph->addEdge(act, curr, force_edge);
+ edgeset.push_back(act);
break;
}
* readfrom(act) --mo--> act
*/
if (act->is_write())
- mo_graph->addEdge(act, curr, force_edge);
+ edgeset.push_back(act);
else if (act->is_read()) {
//if previous read accessed a null, just keep going
- mo_graph->addEdge(act->get_reads_from(), curr, force_edge);
+ edgeset.push_back(act);
}
break;
}
}
}
+ mo_graph->addEdges(&edgeset, curr);
+
}
/**