From 5734b17b928d722e2c6a37c4e152c0dcbf58175d Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 25 May 2012 19:17:51 -0700 Subject: [PATCH] model: add obj_thrd_map Provides a mapping of ModelActions so that we can efficiently sort through the actions on a particular object (memory location) in a particular thread. --- model.cc | 8 +++++++- model.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/model.cc b/model.cc index 24c46b68..86d28ec0 100644 --- a/model.cc +++ b/model.cc @@ -25,6 +25,7 @@ ModelChecker::ModelChecker() nextThread(THREAD_ID_T_NONE), action_trace(new action_list_t()), thread_map(new std::map), + obj_thrd_map(new std::map >()), node_stack(new NodeStack()), next_backtrack(NULL) { @@ -37,8 +38,8 @@ ModelChecker::~ModelChecker() delete (*it).second; delete thread_map; + delete obj_thrd_map; delete action_trace; - delete node_stack; delete scheduler; } @@ -219,6 +220,11 @@ void ModelChecker::check_current_action(void) set_backtracking(curr); this->action_trace->push_back(curr); + + std::vector *vec = &(*obj_thrd_map)[curr->get_location()]; + if (id_to_int(curr->get_tid()) >= (int)vec->size()) + vec->resize(next_thread_id); + (*vec)[id_to_int(curr->get_tid())].push_back(curr); } void ModelChecker::print_summary(void) diff --git a/model.h b/model.h index 9c69ec49..a1ab45e7 100644 --- a/model.h +++ b/model.h @@ -65,6 +65,7 @@ private: ucontext_t *system_context; action_list_t *action_trace; std::map *thread_map; + std::map > *obj_thrd_map; class NodeStack *node_stack; ModelAction *next_backtrack; }; -- 2.34.1