model: launch release sequence fixup actions when necessary
authorBrian Norris <banorris@uci.edu>
Sat, 6 Oct 2012 02:20:21 +0000 (19:20 -0700)
committerBrian Norris <banorris@uci.edu>
Mon, 8 Oct 2012 05:22:52 +0000 (22:22 -0700)
This should complete the "release sequence fixup" step. The ModelChecker
will launch new fixup actions, associating them with the special
'model_thread'.

model.cc

index c1818ad5bfb8fb48c8b8e9221212119b2ca125ff..1fcb8fc0a2ab34b375d7c905e0f32c81699afef8 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -1971,6 +1971,18 @@ bool ModelChecker::take_step() {
        DEBUG("(%d, %d)\n", curr ? id_to_int(curr->get_id()) : -1,
                        next ? id_to_int(next->get_id()) : -1);
 
+       /* When no more threads, or when execution replay chooses the
+        * 'model_thread': launch end-of-execution release sequence fixups */
+       if (!pending_rel_seqs->empty() && (!next || next->is_model_thread())) {
+               printf("*** WARNING: release sequence fixup action (%zu pending release seuqences) ***\n",
+                               pending_rel_seqs->size());
+               ModelAction *fixup = new ModelAction(MODEL_FIXUP_RELSEQ,
+                               std::memory_order_seq_cst, NULL, VALUE_NONE,
+                               model_thread);
+               set_current_action(fixup);
+               return true;
+       }
+
        /* next == NULL -> don't take any more steps */
        if (!next)
                return false;