The rest of the model checker would like to know if any edges were added. Add a
boolean return value to report this.
* Updates the mo_graph with the constraints imposed from the current read.
* @param curr The current action. Must be a read.
* @param rf The action that curr reads from. Must be a write.
* Updates the mo_graph with the constraints imposed from the current read.
* @param curr The current action. Must be a read.
* @param rf The action that curr reads from. Must be a write.
+ * @return True if modification order edges were added; false otherwise
-void ModelChecker::r_modification_order(ModelAction * curr, const ModelAction *rf) {
+bool ModelChecker::r_modification_order(ModelAction *curr, const ModelAction *rf)
+{
std::vector<action_list_t> *thrd_lists = obj_thrd_map->get_safe_ptr(curr->get_location());
unsigned int i;
std::vector<action_list_t> *thrd_lists = obj_thrd_map->get_safe_ptr(curr->get_location());
unsigned int i;
ASSERT(curr->is_read());
/* Iterate over all threads */
ASSERT(curr->is_read());
/* Iterate over all threads */
if (act->happens_before(curr)) {
if (act->is_read()) {
const ModelAction *prevreadfrom = act->get_reads_from();
if (act->happens_before(curr)) {
if (act->is_read()) {
const ModelAction *prevreadfrom = act->get_reads_from();
- if (prevreadfrom != NULL && rf != prevreadfrom)
+ if (prevreadfrom != NULL && rf != prevreadfrom) {
mo_graph->addEdge(prevreadfrom, rf);
mo_graph->addEdge(prevreadfrom, rf);
} else if (rf != act) {
mo_graph->addEdge(act, rf);
} else if (rf != act) {
mo_graph->addEdge(act, rf);
}
/** Updates the mo_graph with the constraints imposed from the current read. */
}
/** Updates the mo_graph with the constraints imposed from the current read. */
/**
* Updates the mo_graph with the constraints imposed from the current write.
* @param curr The current action. Must be a write.
/**
* Updates the mo_graph with the constraints imposed from the current write.
* @param curr The current action. Must be a write.
+ * @return True if modification order edges were added; false otherwise
-void ModelChecker::w_modification_order(ModelAction * curr) {
+bool ModelChecker::w_modification_order(ModelAction *curr)
+{
std::vector<action_list_t> *thrd_lists = obj_thrd_map->get_safe_ptr(curr->get_location());
unsigned int i;
std::vector<action_list_t> *thrd_lists = obj_thrd_map->get_safe_ptr(curr->get_location());
unsigned int i;
ASSERT(curr->is_write());
if (curr->is_seqcst()) {
/* We have to at least see the last sequentially consistent write,
so we are initialized. */
ModelAction *last_seq_cst = get_last_seq_cst(curr->get_location());
ASSERT(curr->is_write());
if (curr->is_seqcst()) {
/* We have to at least see the last sequentially consistent write,
so we are initialized. */
ModelAction *last_seq_cst = get_last_seq_cst(curr->get_location());
- if (last_seq_cst != NULL)
+ if (last_seq_cst != NULL) {
mo_graph->addEdge(last_seq_cst, curr);
mo_graph->addEdge(last_seq_cst, curr);
}
/* Iterate over all threads */
}
/* Iterate over all threads */
mo_graph->addEdge(act->get_reads_from(), curr);
else
mo_graph->addEdge(act, curr);
mo_graph->addEdge(act->get_reads_from(), curr);
else
mo_graph->addEdge(act, curr);
break;
} else if (act->is_read() && !act->is_synchronizing(curr) &&
!act->same_thread(curr)) {
break;
} else if (act->is_read() && !act->is_synchronizing(curr) &&
!act->same_thread(curr)) {
void build_reads_from_past(ModelAction *curr);
ModelAction * process_rmw(ModelAction *curr);
void post_r_modification_order(ModelAction *curr, const ModelAction *rf);
void build_reads_from_past(ModelAction *curr);
ModelAction * process_rmw(ModelAction *curr);
void post_r_modification_order(ModelAction *curr, const ModelAction *rf);
- void r_modification_order(ModelAction *curr, const ModelAction *rf);
- void w_modification_order(ModelAction *curr);
+ bool r_modification_order(ModelAction *curr, const ModelAction *rf);
+ bool w_modification_order(ModelAction *curr);
bool release_seq_head(const ModelAction *rf,
std::vector<const ModelAction *> *release_heads) const;
bool release_seq_head(const ModelAction *rf,
std::vector<const ModelAction *> *release_heads) const;