return act;
}
-
/**
* Processes a read model action.
* @param curr is the read model action to process.
ASSERT(curr);
/* Process this action in ModelHistory for records*/
- model->get_history()->process_action( curr, curr_thrd->get_id() );
+ model->get_history()->process_action( curr, curr->get_tid() );
if (curr_thrd->is_blocked() || curr_thrd->is_complete())
scheduler->remove_thread(curr_thrd);
void * location = act->get_location();
uint64_t read_from_val = act->get_reads_from_value();
- if (thrd_read_map.size() <= tid)
+ /* resize and initialize */
+ uint32_t old_size = thrd_read_map.size();
+ if (old_size <= tid) {
thrd_read_map.resize(tid + 1);
-
- read_map_t * read_map = thrd_read_map[tid];
- if (read_map == NULL) {
- read_map = new read_map_t();
- thrd_read_map[tid] = read_map;
+ for (uint32_t i = old_size; i < tid + 1; i++)
+ thrd_read_map[i] = new read_map_t();
}
+ read_map_t * read_map = thrd_read_map[tid];
read_map->put(location, read_from_val);
/* Store the memory locations where atomic reads happen */
read_locations.push_back(location);
}
-uint64_t FuncNode::query_last_read(ModelAction * act, uint32_t tid)
+uint64_t FuncNode::query_last_read(void * location, uint32_t tid)
{
if (thrd_read_map.size() <= tid)
return 0xdeadbeef;
read_map_t * read_map = thrd_read_map[tid];
- void * location = act->get_location();
/* last read value not found */
if ( !read_map->contains(location) )
void link_insts(func_inst_list_t * inst_list);
void store_read(ModelAction * act, uint32_t tid);
- uint64_t query_last_read(ModelAction * act, uint32_t tid);
+ uint64_t query_last_read(void * location, uint32_t tid);
void clear_read_map(uint32_t tid);
void print_last_read(uint32_t tid);
uint32_t id = id_to_int(tid);
if ( thrd_func_list->size() <= id )
return;
-// else if ( (*thrd_func_list)[id] == NULL)
-// return;
/* get the function id that thread i is currently in */
+ uint32_t func_id = (*thrd_func_list)[id].back();
SnapList<func_inst_list_t *> * func_inst_lists = thrd_func_inst_lists->at(id);
- uint32_t func_id = (*thrd_func_list)[id].back();
if ( func_nodes.size() <= func_id )
resize_func_nodes( func_id + 1 );