small changes
[c11tester.git] / newfuzzer.cc
index ad279770e1588267a1bdc22f3d18c3be2dceaabf..7d4e8b1810880f600393e76f5618af8dc2b9516b 100644 (file)
@@ -33,7 +33,7 @@ void NewFuzzer::register_engine(ModelChecker *_model, ModelExecution *execution)
 
 int NewFuzzer::selectWrite(ModelAction *read, SnapVector<ModelAction *> * rf_set)
 {
-//     return random() % rf_set->size();
+       return random() % rf_set->size();
 
        thread_id_t tid = read->get_tid();
        int thread_id = id_to_int(tid);
@@ -310,27 +310,27 @@ bool NewFuzzer::prune_writes(thread_id_t tid, Predicate * pred, SnapVector<Model
 void NewFuzzer::conditional_sleep(Thread * thread)
 {
 /*
-       int index = paused_thread_list.size();
+        int index = paused_thread_list.size();
 
-       model->getScheduler()->add_sleep(thread);
-       paused_thread_list.push_back(thread);
-       paused_thread_table.put(thread, index); // Update table
+        model->getScheduler()->add_sleep(thread);
+        paused_thread_list.push_back(thread);
+        paused_thread_table.put(thread, index);        // Update table
 
-       // Add the waiting condition to ModelHistory
-       ModelAction * read = thread->get_pending();
-       thread_id_t tid = thread->get_id();
-       FuncNode * func_node = history->get_curr_func_node(tid);
-//     inst_act_map_t * inst_act_map = func_node->get_inst_act_map(tid);
+        // Add the waiting condition to ModelHistory
+        ModelAction * read = thread->get_pending();
+        thread_id_t tid = thread->get_id();
+        FuncNode * func_node = history->get_curr_func_node(tid);
+   //  inst_act_map_t * inst_act_map = func_node->get_inst_act_map(tid);
 
-       Predicate * selected_branch = get_selected_child_branch(tid);
-//     ConcretePredicate * concrete = selected_branch->evaluate(inst_act_map, tid);
-       concrete->set_location(read->get_location());
+        Predicate * selected_branch = get_selected_child_branch(tid);
+   //  ConcretePredicate * concrete = selected_branch->evaluate(inst_act_map, tid);
+        concrete->set_location(read->get_location());
 
-       ASSERT(false);
+        ASSERT(false);
 
-//     history->add_waiting_write(concrete);
-       // history->add_waiting_thread is already called in find_threads
-*/
+   //  history->add_waiting_write(concrete);
+        // history->add_waiting_thread is already called in find_threads
+ */
 }
 
 bool NewFuzzer::has_paused_threads()
@@ -344,7 +344,6 @@ Thread * NewFuzzer::selectThread(int * threadlist, int numthreads)
                wake_up_paused_threads(threadlist, &numthreads);
                //model_print("list size: %d, active t id: %d\n", numthreads, threadlist[0]);
        }
-
        int random_index = random() % numthreads;
        int thread = threadlist[random_index];
        thread_id_t curr_tid = int_to_id(thread);
@@ -448,5 +447,5 @@ bool NewFuzzer::find_threads(ModelAction * pending_read)
 
 bool NewFuzzer::shouldWait(const ModelAction * act)
 {
-       return random() & 1;
+       return true;
 }