func_map(),
func_map_rev(),
func_nodes(),
- write_history()
+ write_history(),
+ write_locations()
{}
void ModelHistory::enter_function(const uint32_t func_id, thread_id_t tid)
thrd_func_inst_lists = model->get_execution()->get_thrd_func_inst_lists();
if ( thrd_func_list->size() <= id ) {
+ uint oldsize = thrd_func_list->size();
thrd_func_list->resize( id + 1 );
+ for(uint i = oldsize; i < id + 1; i++) {
+ new(&(*thrd_func_list)[i]) func_id_list_t();
+ }
thrd_func_inst_lists->resize( id + 1 );
}
uint32_t last_func_id = (*thrd_func_list)[id].back();
if (last_func_id == func_id) {
- /* clear read map upon exiting functions */
FuncNode * func_node = func_nodes[func_id];
func_node->clear_read_map(tid);
if ( old_size < new_size )
func_nodes.resize(new_size);
- for (uint32_t id = old_size; id < new_size; id++) {
+ for (uint32_t id = old_size;id < new_size;id++) {
const char * func_name = func_map_rev[id];
FuncNode * func_node = new FuncNode();
func_node->set_func_id(id);
void ModelHistory::process_action(ModelAction *act, thread_id_t tid)
{
+ action_type act_type = act->get_type();
+ if (act_type == THREAD_FINISH || act_type == THREAD_JOIN ||
+ act_type == PTHREAD_JOIN || act_type == THREADONLY_FINISH)
+ return;
+
/* 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();
if (inst == NULL)
return;
- if (inst->is_read())
- func_node->store_read(act, tid);
+ // if (inst->is_read())
+ // func_node->store_read(act, tid);
if (inst->is_write())
add_to_write_history(act->get_location(), act->get_write_value());
void ModelHistory::add_to_write_history(void * location, uint64_t write_val)
{
- if ( !write_history.contains(location) )
- write_history.put(location, new write_set_t() );
-
write_set_t * write_set = write_history.get(location);
+
+ if (write_set == NULL) {
+ write_set = new write_set_t();
+ write_history.put(location, write_set);
+ }
+
write_set->add(write_val);
+ write_locations.add(location);
}
-void ModelHistory::print()
+void ModelHistory::print_write()
+{
+}
+
+void ModelHistory::print_func_node()
{
/* function id starts with 1 */
- for (uint32_t i = 1;i < func_nodes.size();i++) {
+ for (uint32_t i = 1; i < func_nodes.size(); i++) {
FuncNode * func_node = func_nodes[i];
func_inst_list_mt * entry_insts = func_node->get_entry_insts();
model_print("function %s has entry actions\n", func_node->get_func_name());
- func_inst_list_mt::iterator it;
- for (it = entry_insts->begin();it != entry_insts->end();it++) {
- FuncInst *inst = *it;
+ mllnode<FuncInst*>* it;
+ for (it = entry_insts->begin();it != NULL;it=it->getNext()) {
+ FuncInst *inst = it->getVal();
model_print("type: %d, at: %s\n", inst->get_type(), inst->get_position());
}
-
/*
func_inst_list_mt * inst_list = funcNode->get_inst_list();
FuncInst *inst = *it;
model_print("type: %d, at: %s\n", inst->get_type(), inst->get_position());
}
- */
+*/
}
}