X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=newfuzzer.cc;h=7d4e8b1810880f600393e76f5618af8dc2b9516b;hp=da10e864c2c1776a09718893ad82939935e675b5;hb=7742256df627848c1c375f979f5369a45c92057b;hpb=807bb2d23b9391338ab395bfe0005b378d9026ac diff --git a/newfuzzer.cc b/newfuzzer.cc index da10e864..7d4e8b18 100644 --- a/newfuzzer.cc +++ b/newfuzzer.cc @@ -33,7 +33,7 @@ void NewFuzzer::register_engine(ModelChecker *_model, ModelExecution *execution) int NewFuzzer::selectWrite(ModelAction *read, SnapVector * 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); @@ -49,9 +49,6 @@ int NewFuzzer::selectWrite(ModelAction *read, SnapVector * rf_set Predicate * curr_pred = func_node->get_predicate_tree_position(tid); FuncInst * read_inst = func_node->get_inst(read); - int index = func_node->get_recursion_depth(tid); - uint32_t marker = func_node->get_marker(tid); - if (curr_pred != NULL) { Predicate * selected_branch = NULL; @@ -74,7 +71,7 @@ int NewFuzzer::selectWrite(ModelAction *read, SnapVector * rf_set } thrd_selected_child_branch[thread_id] = selected_branch; - prune_writes(tid, index, marker, selected_branch, rf_set); + prune_writes(tid, selected_branch, rf_set); } thrd_last_read_act[thread_id] = read; @@ -86,9 +83,6 @@ int NewFuzzer::selectWrite(ModelAction *read, SnapVector * rf_set Predicate * selected_branch = get_selected_child_branch(tid); FuncNode * func_node = history->get_curr_func_node(tid); - int index = func_node->get_recursion_depth(tid); - uint32_t marker = func_node->get_marker(tid); - // Increment failure count selected_branch->incr_fail_count(); func_node->add_predicate_to_trace(tid, selected_branch); // For updating predicate weight @@ -106,7 +100,7 @@ int NewFuzzer::selectWrite(ModelAction *read, SnapVector * rf_set selected_branch = selectBranch(tid, curr_pred, read_inst); thrd_selected_child_branch[thread_id] = selected_branch; - prune_writes(tid, index, marker, selected_branch, rf_set); + prune_writes(tid, selected_branch, rf_set); ASSERT(selected_branch); } @@ -224,8 +218,7 @@ Predicate * NewFuzzer::get_selected_child_branch(thread_id_t tid) * * @return true if rf_set is pruned */ -bool NewFuzzer::prune_writes(thread_id_t tid, int index, uint32_t marker, - Predicate * pred, SnapVector * rf_set) +bool NewFuzzer::prune_writes(thread_id_t tid, Predicate * pred, SnapVector * rf_set) { if (pred == NULL) return false; @@ -266,10 +259,12 @@ bool NewFuzzer::prune_writes(thread_id_t tid, int index, uint32_t marker, break; case EQUALITY: FuncInst * to_be_compared; + FuncNode * func_node; uint64_t last_read; to_be_compared = expression->func_inst; - last_read = to_be_compared->get_associated_read(tid, index, marker); + func_node = history->get_curr_func_node(tid); + last_read = func_node->get_associated_read(tid, to_be_compared); ASSERT(last_read != VALUE_NONE); equality = (write_val == last_read); @@ -315,27 +310,27 @@ bool NewFuzzer::prune_writes(thread_id_t tid, int index, uint32_t marker, 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() @@ -349,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); @@ -453,5 +447,5 @@ bool NewFuzzer::find_threads(ModelAction * pending_read) bool NewFuzzer::shouldWait(const ModelAction * act) { - return random() & 1; + return true; }