Fix bug by only putting reads or writes in objthrdmap
authorBrian Demsky <bdemsky@uci.edu>
Mon, 6 Jan 2020 22:10:30 +0000 (14:10 -0800)
committerBrian Demsky <bdemsky@uci.edu>
Mon, 6 Jan 2020 22:10:30 +0000 (14:10 -0800)
execution.cc

index baa5917186df01a86937261c0f61ce833943008c..a76a3e18ac5251605ff4a24db3ba43fb477c16df 100644 (file)
@@ -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();
        }
                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
                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));
        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<action_list_t> *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<ModelAction *> * listref = act->getThrdMapRef();
        }
        {
                sllnode<ModelAction *> * listref = act->getThrdMapRef();
-               if (act->is_wait()) {
-                       if (listref != NULL) {
-                               void *mutex_loc = (void *) act->get_value();
-                               SnapVector<action_list_t> *vec = get_safe_ptr_vect_action(&obj_thrd_map, mutex_loc);
-                               (*vec)[act->get_tid()].erase(listref);
-                       }
-               } else {
-                       if (listref != NULL) {
-                               SnapVector<action_list_t> *vec = get_safe_ptr_vect_action(&obj_thrd_map, act->get_location());
-                               (*vec)[act->get_tid()].erase(listref);
-                       }
+               if (listref != NULL) {
+                       SnapVector<action_list_t> *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()) {
                }
        }
        if ((act->is_fence() && act->is_seqcst()) || act->is_unlock()) {