promise: bugfix - don't check value, check location
authorBrian Norris <banorris@uci.edu>
Fri, 1 Mar 2013 21:07:56 +0000 (13:07 -0800)
committerBrian Norris <banorris@uci.edu>
Fri, 1 Mar 2013 21:18:43 +0000 (13:18 -0800)
I changed a line previously and didn't even notice that I wasn't
matching the comment anymore! Of course, the comment was correct, and my
code was wrong.

model.cc
promise.cc
promise.h

index a66648bce12064d9c6730dc845f8292f277e97f6..d7ffc8e972d7466c7611b393d03afd5a96d5cce0 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -2576,7 +2576,7 @@ void ModelChecker::mo_check_promises(const ModelAction *act, bool is_read_check)
                Promise *promise = (*promises)[i];
 
                // Is this promise on the same location?
                Promise *promise = (*promises)[i];
 
                // Is this promise on the same location?
-               if (promise->get_value() != write->get_value())
+               if (!promise->same_location(write))
                        continue;
 
                for (unsigned int j = 0; j < promise->get_num_readers(); j++) {
                        continue;
 
                for (unsigned int j = 0; j < promise->get_num_readers(); j++) {
index 23b92cd4186a59bb7a5b7c411668501afc4447e7..c695dc0ea21a4657cc04fd8601a28c77752f579b 100644 (file)
@@ -140,3 +140,13 @@ bool Promise::is_compatible_exclusive(const ModelAction *act) const
 {
        return get_num_available_threads() == 1 && is_compatible(act);
 }
 {
        return get_num_available_threads() == 1 && is_compatible(act);
 }
+
+/**
+ * @brief Check if a ModelAction's location matches this Promise
+ * @param act The ModelAction to check
+ * @return True if the action's location matches this Promise
+ */
+bool Promise::same_location(const ModelAction *act) const
+{
+       return get_reader(0)->same_var(act);
+}
index 5ea7dc58d0470a29a537985c6322f8792be1f856..4131470457cc7e4eb2ed2520ed2489aa8f3de66e 100644 (file)
--- a/promise.h
+++ b/promise.h
@@ -36,6 +36,7 @@ class Promise {
        int get_num_available_threads() const { return num_available_threads; }
        bool is_compatible(const ModelAction *act) const;
        bool is_compatible_exclusive(const ModelAction *act) const;
        int get_num_available_threads() const { return num_available_threads; }
        bool is_compatible(const ModelAction *act) const;
        bool is_compatible_exclusive(const ModelAction *act) const;
+       bool same_location(const ModelAction *act) const;
 
        modelclock_t get_expiration() const { return fv.expiration; }
        uint64_t get_value() const { return fv.value; }
 
        modelclock_t get_expiration() const { return fv.expiration; }
        uint64_t get_value() const { return fv.value; }