Merge branch 'branch-weiyu' of ssh://plrg.eecs.uci.edu:/home/git/random-fuzzer into...
[c11tester.git] / execution.cc
index 6fe0569678be9844bc13436a1dd39c02d6af019a..6d435dec095c4185a6b0dbbf89923a70431f3e73 100644 (file)
@@ -271,7 +271,7 @@ ModelAction * ModelExecution::convertNonAtomicStore(void * location) {
        add_normal_write_to_lists(act);
        add_write_to_lists(act);
        w_modification_order(act);
-//     model->get_history()->process_action(act, act->get_tid());
+       model->get_history()->process_action(act, act->get_tid());
        return act;
 }
 
@@ -291,19 +291,18 @@ bool ModelExecution::process_read(ModelAction *curr, SnapVector<ModelAction *> *
        }
 
        // Remove writes that violate read modification order
-       /*
-          for (uint i = 0; i < rf_set->size(); i++) {
-               ModelAction * rf = (*rf_set)[i];
-               if (!r_modification_order(curr, rf, NULL, NULL, true)) {
-                       (*rf_set)[i] = rf_set->back();
-                       rf_set->pop_back();
-               }
-          }*/
+       uint i = 0;
+       while (i < rf_set->size()) {
+               ModelAction * rf = (*rf_set)[i];
+               if (!r_modification_order(curr, rf, NULL, NULL, true)) {
+                       (*rf_set)[i] = rf_set->back();
+                       rf_set->pop_back();
+               } else
+                       i++;
+       }
 
        while(true) {
                int index = fuzzer->selectWrite(curr, rf_set);
-               if (index == -1)// no feasible write exists
-                       return false;
 
                ModelAction *rf = (*rf_set)[index];
 
@@ -322,6 +321,9 @@ bool ModelExecution::process_read(ModelAction *curr, SnapVector<ModelAction *> *
                        }
                        return true;
                }
+
+               ASSERT(false);
+               /* TODO: Following code not needed anymore */
                priorset->clear();
                (*rf_set)[index] = rf_set->back();
                rf_set->pop_back();
@@ -722,12 +724,6 @@ ModelAction * ModelExecution::check_current_action(ModelAction *curr)
        if (curr->is_read() && !second_part_of_rmw) {
                process_read(curr, rf_set);
                delete rf_set;
-
-/*             bool success = process_read(curr, rf_set);
-                delete rf_set;
-                if (!success)
-                        return curr;   // Do not add action to lists
- */
        } else
                ASSERT(rf_set == NULL);
 
@@ -1709,7 +1705,7 @@ Thread * ModelExecution::take_step(ModelAction *curr)
        ASSERT(curr);
 
        /* Process this action in ModelHistory for records */
-//     model->get_history()->process_action( curr, curr->get_tid() );
+       model->get_history()->process_action( curr, curr->get_tid() );
 
        if (curr_thrd->is_blocked() || curr_thrd->is_complete())
                scheduler->remove_thread(curr_thrd);