thrd_last_action(1),
thrd_last_fence_release(),
priv(new struct model_snapshot_members ()),
- mo_graph(new CycleGraph()),
+ mo_graph(new CycleGraph()),
fuzzer(new Fuzzer()),
thrd_func_list(),
thrd_func_inst_lists()
void insertIntoActionList(action_list_t *list, ModelAction *act) {
action_list_t::reverse_iterator rit = list->rbegin();
modelclock_t next_seq = act->get_seq_number();
- if ((*rit)->get_seq_number() == next_seq)
+ if (rit == list->rend() || (*rit)->get_seq_number() == next_seq)
list->push_back(act);
else {
for(;rit != list->rend();rit++) {
}
}
+void insertIntoActionListAndSetCV(action_list_t *list, ModelAction *act) {
+ action_list_t::reverse_iterator rit = list->rbegin();
+ modelclock_t next_seq = act->get_seq_number();
+ if (rit == list->rend()) {
+ act->create_cv(NULL);
+ } else if ((*rit)->get_seq_number() == next_seq) {
+ act->create_cv((*rit));
+ list->push_back(act);
+ } else {
+ for(;rit != list->rend();rit++) {
+ if ((*rit)->get_seq_number() == next_seq) {
+ act->create_cv((*rit));
+ action_list_t::iterator it = rit.base();
+ it++; //get to right sequence number
+ it++; //get to item after it
+ list->insert(it, act);
+ break;
+ }
+ }
+ }
+}
+
/**
* Performs various bookkeeping operations for a normal write. The
* complication is that we are typically inserting a normal write
int tid = id_to_int(act->get_tid());
action_list_t *list = get_safe_ptr_action(&obj_map, act->get_location());
insertIntoActionList(list, act);
- insertIntoActionList(&action_trace, act);
+ insertIntoActionListAndSetCV(&action_trace, act);
// Update obj_thrd_map, a per location, per thread, order of actions
SnapVector<action_list_t> *vec = get_safe_ptr_vect_action(&obj_thrd_map, act->get_location());