From: weiyu Date: Tue, 6 Aug 2019 20:38:58 +0000 (-0700) Subject: move modelhistory code back X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=4752e48158e7c5c90472214c366b0eaa1ec09a71 move modelhistory code back --- diff --git a/execution.cc b/execution.cc index f978cd4c..d477a04a 100644 --- a/execution.cc +++ b/execution.cc @@ -1164,15 +1164,6 @@ void ModelExecution::add_action_to_lists(ModelAction *act) } (*vec)[tid].push_back(act); } - - /* Update thrd_func_act_lists, list of actions in functions entered by each thread - * To be used by FuncNode and only care about actions with a position */ - if (act->get_position() != NULL) { - SnapList * func_act_lists = thrd_func_act_lists[tid]; - action_list_t * curr_act_list = func_act_lists->back(); - ASSERT(curr_act_list != NULL); - curr_act_list->push_back(act); - } } void insertIntoActionList(action_list_t *list, ModelAction *act) { diff --git a/history.cc b/history.cc index db5cbcac..0a25caf5 100644 --- a/history.cc +++ b/history.cc @@ -99,6 +99,8 @@ void ModelHistory::process_action(ModelAction *act, thread_id_t tid) /* return if thread i has not entered any function or has exited from all functions */ SnapVector * thrd_func_list = model->get_execution()->get_thrd_func_list(); + SnapVector< SnapList *> * + thrd_func_act_lists = model->get_execution()->get_thrd_func_act_lists(); uint32_t id = id_to_int(tid); if ( thrd_func_list->size() <= id ) @@ -106,6 +108,7 @@ void ModelHistory::process_action(ModelAction *act, thread_id_t tid) /* get the function id that thread i is currently in */ uint32_t func_id = (*thrd_func_list)[id].back(); + SnapList * func_act_lists = (*thrd_func_act_lists)[id]; if (func_id == 0) return; @@ -123,6 +126,20 @@ void ModelHistory::process_action(ModelAction *act, thread_id_t tid) if (act->is_write()) add_to_write_history(act->get_location(), act->get_write_value()); + + /* add to curr_inst_list */ + action_list_t * curr_act_list = func_act_lists->back(); + ASSERT(curr_act_list != NULL); + + ModelAction * last_act; + if (curr_act_list->size() != 0) + last_act = curr_act_list->back(); + + /* do not add actions with the same sequence number twice */ + if (last_act != NULL && last_act->get_seq_number() == act->get_seq_number()) + return; + + curr_act_list->push_back(act); } /* return the FuncNode given its func_id */