{
//model_print("thread %d entering func %d\n", tid, func_id);
uint32_t id = id_to_int(tid);
- SnapVector<func_id_list_t *> * thrd_func_list = model->get_execution()->get_thrd_func_list();
+ SnapVector<func_id_list_t> * thrd_func_list = model->get_execution()->get_thrd_func_list();
SnapVector< SnapList<func_inst_list_t *> *> *
thrd_func_inst_lists = model->get_execution()->get_thrd_func_inst_lists();
thrd_func_inst_lists->resize( id + 1 );
}
- func_id_list_t * func_list = thrd_func_list->at(id);
SnapList<func_inst_list_t *> * func_inst_lists = thrd_func_inst_lists->at(id);
- if (func_list == NULL) {
- func_list = new func_id_list_t();
- thrd_func_list->at(id) = func_list;
- }
-
if (func_inst_lists == NULL) {
func_inst_lists = new SnapList< func_inst_list_t *>();
thrd_func_inst_lists->at(id) = func_inst_lists;
}
- func_list->push_back(func_id);
+ (*thrd_func_list)[id].push_back(func_id);
func_inst_lists->push_back( new func_inst_list_t() );
if ( func_nodes.size() <= func_id )
void ModelHistory::exit_function(const uint32_t func_id, thread_id_t tid)
{
uint32_t id = id_to_int(tid);
- SnapVector<func_id_list_t *> * thrd_func_list = model->get_execution()->get_thrd_func_list();
+ SnapVector<func_id_list_t> * thrd_func_list = model->get_execution()->get_thrd_func_list();
SnapVector< SnapList<func_inst_list_t *> *> *
thrd_func_inst_lists = model->get_execution()->get_thrd_func_inst_lists();
- func_id_list_t * func_list = thrd_func_list->at(id);
SnapList<func_inst_list_t *> * func_inst_lists = thrd_func_inst_lists->at(id);
-
- uint32_t last_func_id = func_list->back();
+ uint32_t last_func_id = (*thrd_func_list)[id].back();
if (last_func_id == func_id) {
/* clear read map upon exiting functions */
func_inst_list_t * curr_inst_list = func_inst_lists->back();
func_node->link_insts(curr_inst_list);
- func_list->pop_back();
+ (*thrd_func_list)[id].pop_back();
func_inst_lists->pop_back();
} else {
model_print("trying to exit with a wrong function id\n");
{
/* return if thread i has not entered any function or has exited
from all functions */
- SnapVector<func_id_list_t *> * thrd_func_list = model->get_execution()->get_thrd_func_list();
+ SnapVector<func_id_list_t> * thrd_func_list = model->get_execution()->get_thrd_func_list();
SnapVector< SnapList<func_inst_list_t *> *> *
thrd_func_inst_lists = model->get_execution()->get_thrd_func_inst_lists();
uint32_t id = id_to_int(tid);
if ( thrd_func_list->size() <= id )
return;
- else if (thrd_func_list->at(id) == NULL)
- return;
+// else if ( (*thrd_func_list)[id] == NULL)
+// return;
/* get the function id that thread i is currently in */
- func_id_list_t * func_list = thrd_func_list->at(id);
SnapList<func_inst_list_t *> * func_inst_lists = thrd_func_inst_lists->at(id);
- uint32_t func_id = func_list->back();
-
+ uint32_t func_id = (*thrd_func_list)[id].back();
if ( func_nodes.size() <= func_id )
resize_func_nodes( func_id + 1 );
return func_nodes[func_id];
}
+uint64_t ModelHistory::query_last_read(void * location, thread_id_t tid)
+{
+ SnapVector<func_id_list_t> * thrd_func_list = model->get_execution()->get_thrd_func_list();
+ uint32_t id = id_to_int(tid);
+
+ ASSERT( thrd_func_list->size() > id );
+ uint32_t func_id = (*thrd_func_list)[id].back();
+ FuncNode * func_node = func_nodes[func_id];
+
+ uint64_t last_read_val = 0xdeadbeef;
+ if (func_node != NULL) {
+ last_read_val = func_node->query_last_read(location, tid);
+ }
+
+ return last_read_val;
+}
+
void ModelHistory::print()
{
/* function id starts with 1 */