2 #include "threads-model.h"
9 * @brief Register the ModelHistory and ModelExecution engine
11 void NewFuzzer::register_engine(ModelHistory * history, ModelExecution *execution)
13 this->history = history;
14 this->execution = execution;
18 int NewFuzzer::selectWrite(ModelAction *read, SnapVector<ModelAction *> * rf_set)
20 thread_id_t tid = read->get_tid();
21 int thread_id = id_to_int(tid);
23 SnapVector<func_id_list_t> * thrd_func_list = execution->get_thrd_func_list();
24 uint32_t func_id = (*thrd_func_list)[thread_id].back();
26 FuncNode * func_node = history->get_func_node(func_id);
27 FuncInst * read_inst = func_node->get_inst(read);
28 Predicate * curr_pred = func_node->get_predicate_tree_position(tid);
30 ModelVector<Predicate *> * children = curr_pred->get_children();
31 if (children->size() == 0)
32 return random() % rf_set->size();
34 int random_index = random() % rf_set->size();