more fixes
authorroot <root@dw-6.eecs.uci.edu>
Tue, 30 Jul 2019 20:46:23 +0000 (13:46 -0700)
committerroot <root@dw-6.eecs.uci.edu>
Tue, 30 Jul 2019 20:46:23 +0000 (13:46 -0700)
cyclegraph.cc
stl-model.h

index 966a5035a9fd484074b2a6802bff58cc119e58ae..3da8dc544d5dbe42a20f358e659f6931f2c49238 100644 (file)
@@ -138,13 +138,13 @@ void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw)
 }
 
 void CycleGraph::addEdges(SnapList<ModelAction *> * edgeset, const ModelAction *to) {
-       for(SnapList<ModelAction*>::iterator it = edgeset->begin();it!=edgeset->end();) {
-               ModelAction *act = *it;
+       for(sllnode<ModelAction*> * it = edgeset->begin();it!=NULL;) {
+         ModelAction *act = it->getVal();
                CycleNode *node = getNode(act);
-               SnapList<ModelAction*>::iterator it2 = it;
-               it2++;
-               for(;it2!=edgeset->end(); ) {
-                       ModelAction *act2 = *it2;
+               sllnode<ModelAction*> * it2 = it;
+               it2=it2->getNext();
+               for(;it2!=NULL; ) {
+                 ModelAction *act2 = it2->getVal();
                        CycleNode *node2 = getNode(act2);
                        if (checkReachable(node, node2)) {
                                it = edgeset->erase(it);
@@ -153,16 +153,16 @@ void CycleGraph::addEdges(SnapList<ModelAction *> * edgeset, const ModelAction *
                                it2 = edgeset->erase(it2);
                                goto endinnerloop;
                        }
-                       it2++;
+                       it2=it2->getNext();
 endinnerloop:
                        ;
                }
-               it++;
+               it=it->getNext();
 endouterloop:
                ;
        }
-       for(SnapList<ModelAction*>::iterator it = edgeset->begin();it!=edgeset->end();it++) {
-               ModelAction *from = *it;
+       for(sllnode<ModelAction*> *it = edgeset->begin();it!=NULL;it=it->getNext()) {
+         ModelAction *from = it->getVal();
                addEdge(from, to, from->get_tid() == to->get_tid());
        }
 }
index 24ed29a6ddd33306dff6d0d1543f61b7b6c23ebf..bf34ec7d60b03ba10ea3b3df6c3b3891b629ef9c 100644 (file)
@@ -10,12 +10,14 @@ class mllnode {
   _Tp getVal() {return val;}
   mllnode<_Tp> * getNext() {return next;}
   mllnode<_Tp> * getPrev() {return prev;}
+
   MEMALLOC;
   
  private:
   mllnode<_Tp> * next;
   mllnode<_Tp> * prev;
   _Tp val;
+  template<typename T>
   friend class ModelList;
 };
 
@@ -76,7 +78,7 @@ public:
     }
   }
   
-  void erase(mllnode<_Tp> * node) {
+  mllnode<_Tp> * erase(mllnode<_Tp> * node) {
     if (head == node) {
       head = node->next;
     } else {
@@ -88,15 +90,16 @@ public:
     } else {
       tail->next->prev = node->prev;
     }
-    
+    mllnode<_Tp> *next = node->next;
     delete node;
+    return next;
   }
   
-  mllnode<_Tp> begin() {
+  mllnode<_Tp> begin() {
     return head;
   }
 
-  mllnode<_Tp> end() {
+  mllnode<_Tp> end() {
     return tail;
   }
   
@@ -127,6 +130,7 @@ class sllnode {
   sllnode<_Tp> * next;
   sllnode<_Tp> * prev;
   _Tp val;
+  template<typename T>
   friend class SnapList;
 };
 
@@ -187,7 +191,7 @@ public:
     }
   }
   
-  void erase(sllnode<_Tp> * node) {
+  sllnode<_Tp> * erase(sllnode<_Tp> * node) {
     if (head == node) {
       head = node->next;
     } else {
@@ -199,15 +203,17 @@ public:
     } else {
       tail->next->prev = node->prev;
     }
-    
+
+    sllnode<_Tp> *next = node->next;
     delete node;
+    return next;
   }
   
-  sllnode<_Tp> begin() {
+  sllnode<_Tp> begin() {
     return head;
   }
 
-  sllnode<_Tp> end() {
+  sllnode<_Tp> end() {
     return tail;
   }