* @todo Finish lazy updating, when promises are fulfilled in the future
* @param rf The action that might be part of a release sequence. Must be a
* write.
- * @param release_heads A pass-by-reference style return parameter. After
+ * @param release_heads A pass-by-reference style return parameter. After
* execution of this function, release_heads will contain the heads of all the
- * relevant release sequences, if any exists
+ * relevant release sequences, if any exists with certainty
+ * @param pending A pass-by-reference style return parameter which is only used
+ * when returning false (i.e., uncertain). Returns most information regarding
+ * an uncertain release sequence, including any write operations that might
+ * break the sequence.
* @return true, if the ModelChecker is certain that release_heads is complete;
* false otherwise
*/
-bool ModelChecker::release_seq_heads(const ModelAction *rf, rel_heads_list_t *release_heads) const
+bool ModelChecker::release_seq_heads(const ModelAction *rf,
+ rel_heads_list_t *release_heads,
+ struct release_seq *pending) const
{
/* Only check for release sequences if there are no cycles */
if (mo_graph->checkForCycles())
};
if (!rf) {
/* read from future: need to settle this later */
+ pending->rf = NULL;
return false; /* incomplete */
}
ASSERT(rf->same_thread(release));
+ pending->writes.clear();
+
bool certain = true;
for (unsigned int i = 0; i < thrd_lists->size(); i++) {
if (id_to_int(rf->get_tid()) == (int)i)
/* release --mo-> act --mo--> rf */
return true; /* complete */
}
+ /* act may break release sequence */
+ pending->writes.push_back(act);
certain = false;
}
if (!future_ordered)
- return false; /* This thread is uncertain */
+ certain = false; /* This thread is uncertain */
}
- if (certain)
+ if (certain) {
release_heads->push_back(release);
+ pending->writes.clear();
+ } else {
+ pending->release = release;
+ pending->rf = rf;
+ }
return certain;
}
struct release_seq *sequence = (struct release_seq *)snapshot_calloc(1, sizeof(struct release_seq));
sequence->acquire = act;
- if (!release_seq_heads(rf, release_heads)) {
+ if (!release_seq_heads(rf, release_heads, sequence)) {
/* add act to 'lazy checking' list */
pending_rel_seqs->push_back(sequence);
} else {
const ModelAction *rf = act->get_reads_from();
rel_heads_list_t release_heads;
bool complete;
- complete = release_seq_heads(rf, &release_heads);
+ complete = release_seq_heads(rf, &release_heads, pending);
for (unsigned int i = 0; i < release_heads.size(); i++) {
if (!act->has_synchronized_with(release_heads[i])) {
if (act->synchronize_with(release_heads[i]))
void post_r_modification_order(ModelAction *curr, const ModelAction *rf);
bool r_modification_order(ModelAction *curr, const ModelAction *rf);
bool w_modification_order(ModelAction *curr);
- bool release_seq_heads(const ModelAction *rf, rel_heads_list_t *release_heads) const;
+ bool release_seq_heads(const ModelAction *rf, rel_heads_list_t *release_heads, struct release_seq *pending) const;
bool resolve_release_sequences(void *location, work_queue_t *work_queue);
void do_complete_join(ModelAction *join);