bug fix
[c11tester.git] / history.cc
index 7b6e3c87fe6adfca4e5bbcd54e99203b8ec35234..a609fbf5c3d30a9c70692266e1f5a9fb8576a895 100644 (file)
@@ -14,7 +14,8 @@ ModelHistory::ModelHistory() :
        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)
@@ -156,17 +157,25 @@ uint64_t ModelHistory::query_last_read(void * location, thread_id_t tid)
 
 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();
@@ -177,7 +186,6 @@ void ModelHistory::print()
                        FuncInst *inst = *it;
                        model_print("type: %d, at: %s\n", inst->get_type(), inst->get_position());
                }
-
 /*
                 func_inst_list_mt * inst_list = funcNode->get_inst_list();
 
@@ -187,6 +195,6 @@ void ModelHistory::print()
                         FuncInst *inst = *it;
                         model_print("type: %d, at: %s\n", inst->get_type(), inst->get_position());
                 }
- */
+*/
        }
 }