bug fixes
authorroot <root@plrg-1.ics.uci.edu>
Mon, 30 Dec 2019 08:19:08 +0000 (00:19 -0800)
committerroot <root@plrg-1.ics.uci.edu>
Mon, 30 Dec 2019 08:19:08 +0000 (00:19 -0800)
action.h
execution.cc

index 1658a83..66e1190 100644 (file)
--- a/action.h
+++ b/action.h
@@ -102,6 +102,7 @@ public:
 
        thread_id_t get_tid() const { return tid; }
        action_type get_type() const { return type; }
+       void set_type(action_type _type) { type = _type; }
        void set_free() { type = READY_FREE; }
        memory_order get_mo() const { return order; }
        memory_order get_original_mo() const { return original_order; }
index e462748..63c0ac7 100644 (file)
@@ -1779,8 +1779,10 @@ void ModelExecution::collectActions() {
                        }
                }
        }
-       for (sllnode<ModelAction*> * it2 = action_trace.end();it2 != it;it2=it2->getPrev()) {
+       for (sllnode<ModelAction*> * it2 = action_trace.end();it2 != it;) {
                ModelAction *act = it2->getVal();
+               //Do iteration early in case we delete the act
+               it2=it2->getPrev();
                bool islastact = false;
                ModelAction *lastact = get_last_action(act->get_tid());
                if (act == lastact) {
@@ -1789,6 +1791,9 @@ void ModelExecution::collectActions() {
                }
 
                if (act->is_read() && act->get_reads_from()->is_free()) {
+                       if (act->is_rmw()) {
+                               act->set_type(ATOMIC_WRITE);
+                       }
                        removeAction(act);
                        if (islastact) {
                                fixupLastAct(act);
@@ -1808,7 +1813,9 @@ void ModelExecution::collectActions() {
                }
 
                if (act->is_read()) {
-                       if (act->get_reads_from()->is_free()) {
+                       if (act->is_rmw()) {
+                               act->set_type(ATOMIC_WRITE);
+                       } else if (act->get_reads_from()->is_free()) {
                                removeAction(act);
                                if (islastact) {
                                        fixupLastAct(act);