read_map->put(location, read_from_val);
/* Store the memory locations where atomic reads happen */
- bool push_loc = true;
- ModelList<void *>::iterator it;
- for (it = read_locations.begin();it != read_locations.end();it++) {
- if (location == *it) {
- push_loc = false;
- break;
- }
- }
-
- if (push_loc)
- read_locations.push_back(location);
+ read_locations.add(location);
}
uint64_t FuncNode::query_last_read(void * location, uint32_t tid)
*/
void FuncNode::print_last_read(uint32_t tid)
{
+/*
ASSERT(thrd_read_map.size() > tid);
read_map_t * read_map = thrd_read_map[tid];
uint64_t read_val = read_map->get(*it);
model_print("last read of thread %d at %p: 0x%x\n", tid, *it, read_val);
}
+*/
}
#include "action.h"
#include "funcinst.h"
#include "hashtable.h"
+#include "hashset.h"
typedef ModelList<FuncInst *> func_inst_list_mt;
typedef HashTable<void *, uint64_t, uintptr_t, 4, model_malloc, model_calloc, model_free> read_map_t;
/* Store the values read by atomic read actions per memory location for each thread */
ModelVector<read_map_t *> thrd_read_map;
- ModelList<void *> read_locations;
+ HashSet<void *, uintptr_t, 4, model_malloc, model_calloc, model_free> read_locations;
};
#endif /* __FUNCNODE_H__ */
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);
}
#include "hashset.h"
#include "threads-model.h"
-typedef HashSet<uint64_t, uint64_t, 4, model_malloc, model_calloc, model_free> write_set_t;
+typedef HashSet<uint64_t, uint64_t, 0, model_malloc, model_calloc, model_free> write_set_t;
class ModelHistory {
public: