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())
{
/* Initialize a model-checker thread, for special ModelActions */
if (!second_part_of_rmw && curr->get_type() != NOOP)
add_action_to_lists(curr);
+ if (curr->is_write())
+ add_write_to_lists(curr);
+
SnapVector<ModelAction *> * rf_set = NULL;
/* Build may_read_from set for newly-created actions */
if (newly_explored && curr->is_read())
}
i--;
if (i >= 0) {
- rf = (*processset)[i];
+ rf = (*processset)[i];
} else
- break;
+ break;
}
if (processset != NULL)
delete processset;
}
}
+void ModelExecution::add_write_to_lists(ModelAction *write) {
+ // Update seq_cst map
+ if (write->is_seqcst())
+ obj_last_sc_map.put(write->get_location(), write);
+}
+
/**
* @brief Get the last action performed by a particular Thread
* @param tid The thread ID of the Thread in question
ModelAction * ModelExecution::get_last_seq_cst_write(ModelAction *curr) const
{
void *location = curr->get_location();
- action_list_t *list = obj_map.get(location);
- /* Find: max({i in dom(S) | seq_cst(t_i) && isWrite(t_i) && samevar(t_i, t)}) */
- action_list_t::reverse_iterator rit;
- for (rit = list->rbegin();(*rit) != curr;rit++)
- ;
- rit++; /* Skip past curr */
- for ( ;rit != list->rend();rit++)
- if ((*rit)->is_write() && (*rit)->is_seqcst())
- return *rit;
- return NULL;
+ return obj_last_sc_map.get(location);
}
/**