promise: rename has_sync_thread() -> thread_is_eliminated()
authorBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 20:36:28 +0000 (12:36 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 20:38:49 +0000 (12:38 -0800)
This function doesn't actually check for synchronization; there are
numerous ways to be eliminated.

model.cc
promise.cc
promise.h

index 0964ae7ed2be03721cca662598200382151b2230..ac88933357cc3d6be512b0b61509846cbd50e4aa 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -2459,7 +2459,7 @@ void ModelChecker::mo_check_promises(thread_id_t tid, const ModelAction *write,
                }
 
                //Don't do any lookups twice for the same thread
-               if (promise->has_sync_thread(tid))
+               if (promise->thread_is_eliminated(tid))
                        continue;
 
                if (promise->get_write() && mo_graph->checkReachable(promise->get_write(), write)) {
index 7b110020cd869514c0f958055fea357f9f3c42ba..3b2aa960f967bb389d48b24fe61e0d4f62664471 100644 (file)
 bool Promise::eliminate_thread(thread_id_t tid)
 {
        unsigned int id = id_to_int(tid);
-       if (id >= synced_thread.size())
-               synced_thread.resize(id + 1, false);
-       if (synced_thread[id])
+       if (id >= eliminated_thread.size())
+               eliminated_thread.resize(id + 1, false);
+       if (eliminated_thread[id])
                return false;
 
-       synced_thread[id] = true;
+       eliminated_thread[id] = true;
        return has_failed();
 }
 
@@ -30,10 +30,10 @@ bool Promise::eliminate_thread(thread_id_t tid)
  */
 bool Promise::has_failed() const
 {
-       unsigned int sync_size = synced_thread.size();
+       unsigned int size = eliminated_thread.size();
        int promise_tid = id_to_int(read->get_tid());
        for (unsigned int i = 1; i < model->get_num_threads(); i++) {
-               if ((i >= sync_size || !synced_thread[i]) && ((int)i != promise_tid) && model->is_enabled(int_to_id(i))) {
+               if ((i >= size || !eliminated_thread[i]) && ((int)i != promise_tid) && model->is_enabled(int_to_id(i))) {
                        return false;
                }
        }
index f30779c2131babfe0eb60038667f98cd5c73e2b2..9fd6552d06bbe3746767376e9ddb270516b4437c 100644 (file)
--- a/promise.h
+++ b/promise.h
@@ -32,11 +32,18 @@ class Promise {
        ModelAction * get_action() const { return read; }
        bool eliminate_thread(thread_id_t tid);
 
-       bool has_sync_thread(thread_id_t tid) {
+       /**
+        * Check if a thread has already been eliminated from resolving this
+        * promise
+        * @param tid Thread ID of the thread to check
+        * @return True if the thread is already eliminated; false otherwise
+        */
+       bool thread_is_eliminated(thread_id_t tid) const
+       {
                unsigned int id = id_to_int(tid);
-               if (id >= synced_thread.size())
+               if (id >= eliminated_thread.size())
                        return false;
-               return synced_thread[id];
+               return eliminated_thread[id];
        }
 
        bool has_failed() const;
@@ -46,7 +53,7 @@ class Promise {
 
        SNAPSHOTALLOC
  private:
-       std::vector<bool> synced_thread;
+       std::vector<bool> eliminated_thread;
        const uint64_t value;
        const modelclock_t expiration;
        ModelAction * const read;