model: fix bugs in fence-acquire synchronization
authorBrian Norris <banorris@uci.edu>
Wed, 5 Dec 2012 00:40:32 +0000 (16:40 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 5 Dec 2012 00:40:32 +0000 (16:40 -0800)
(1) In the fence-acquire search, we can't stop searching for prior loads
    when we reach the current action; we must continue to search until
    we find a *different* fence-acquire (or the beginning of the thread)

(2) The load action does not synchronize in fence-acquire
    synchronization: the fence should synchronize. This was just a typo
    (act vs. curr).

model.cc

index 6120f4d..b73d31a 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -879,6 +879,8 @@ bool ModelChecker::process_fence(ModelAction *curr)
                /* Find X : is_read(X) && X --sb-> curr */
                for (rit = list->rbegin(); rit != list->rend(); rit++) {
                        ModelAction *act = *rit;
                /* Find X : is_read(X) && X --sb-> curr */
                for (rit = list->rbegin(); rit != list->rend(); rit++) {
                        ModelAction *act = *rit;
+                       if (act == curr)
+                               continue;
                        if (act->get_tid() != curr->get_tid())
                                continue;
                        /* Stop at the beginning of the thread */
                        if (act->get_tid() != curr->get_tid())
                                continue;
                        /* Stop at the beginning of the thread */
@@ -897,7 +899,7 @@ bool ModelChecker::process_fence(ModelAction *curr)
                        rel_heads_list_t release_heads;
                        get_release_seq_heads(curr, act, &release_heads);
                        for (unsigned int i = 0; i < release_heads.size(); i++)
                        rel_heads_list_t release_heads;
                        get_release_seq_heads(curr, act, &release_heads);
                        for (unsigned int i = 0; i < release_heads.size(); i++)
-                               if (!act->synchronize_with(release_heads[i]))
+                               if (!curr->synchronize_with(release_heads[i]))
                                        set_bad_synchronization();
                        if (release_heads.size() != 0)
                                updated = true;
                                        set_bad_synchronization();
                        if (release_heads.size() != 0)
                                updated = true;