From: Brian Demsky Date: Mon, 6 Jan 2020 22:10:30 +0000 (-0800) Subject: Fix bug by only putting reads or writes in objthrdmap X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f4917b6ec74b4c36c19ad7dc92fe888a94357486;p=c11tester.git Fix bug by only putting reads or writes in objthrdmap --- diff --git a/execution.cc b/execution.cc index baa59171..a76a3e18 100644 --- a/execution.cc +++ b/execution.cc @@ -1135,7 +1135,7 @@ void ModelExecution::add_action_to_lists(ModelAction *act, bool canprune) for(uint i = oldsize;i < priv->next_thread_id;i++) new (&(*vec)[i]) action_list_t(); } - if (!canprune) + if (!canprune && (act->is_read() || act->is_write())) act->setThrdMapRef((*vec)[tid].add_back(act)); // Update thrd_last_action, the last action taken by each thread @@ -1153,15 +1153,6 @@ void ModelExecution::add_action_to_lists(ModelAction *act, bool canprune) if (act->is_wait()) { void *mutex_loc = (void *) act->get_value(); act->setActionRef(get_safe_ptr_action(&obj_map, mutex_loc)->add_back(act)); - - SnapVector *vec = get_safe_ptr_vect_action(&obj_thrd_map, mutex_loc); - if ((int)vec->size() <= tid) { - uint oldsize = vec->size(); - vec->resize(priv->next_thread_id); - for(uint i = oldsize;i < priv->next_thread_id;i++) - new (&(*vec)[i]) action_list_t(); - } - act->setThrdMapRef((*vec)[tid].add_back(act)); } } @@ -1671,17 +1662,9 @@ void ModelExecution::removeAction(ModelAction *act) { } { sllnode * listref = act->getThrdMapRef(); - if (act->is_wait()) { - if (listref != NULL) { - void *mutex_loc = (void *) act->get_value(); - SnapVector *vec = get_safe_ptr_vect_action(&obj_thrd_map, mutex_loc); - (*vec)[act->get_tid()].erase(listref); - } - } else { - if (listref != NULL) { - SnapVector *vec = get_safe_ptr_vect_action(&obj_thrd_map, act->get_location()); - (*vec)[act->get_tid()].erase(listref); - } + if (listref != NULL) { + SnapVector *vec = get_safe_ptr_vect_action(&obj_thrd_map, act->get_location()); + (*vec)[act->get_tid()].erase(listref); } } if ((act->is_fence() && act->is_seqcst()) || act->is_unlock()) {