action: refactor ATOMIC_READ printing
authorBrian Norris <banorris@uci.edu>
Wed, 12 Dec 2012 02:05:51 +0000 (18:05 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 12 Dec 2012 02:05:51 +0000 (18:05 -0800)
For ATOMIC_READ, we don't need a special case to print VALUE_NONE,
because any action where the value isn't explicitly set (e.g., all
ATOMIC_READ actions) default to VALUE_NONE. And if this 'default'
changes in the future, we would want to print it.

(Right now it's confusing, for instance, when we have a failed promise
execution, since the model-checker trace gives no indication of what the
promised value actually *was*. This should be fixed sometime.)

action.cc

index e88fceef66a8d173e851f4439afd55f1d96564f4..a11467587901f258a03b9e11623403f60f3d1263 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -470,7 +470,11 @@ void ModelAction::print() const
                type_str = "unknown type";
        }
 
-       uint64_t valuetoprint=type==ATOMIC_READ?(reads_from!=NULL?reads_from->value:VALUE_NONE):value;
+       uint64_t valuetoprint;
+       if (type == ATOMIC_READ && reads_from != NULL)
+               valuetoprint = reads_from->value;
+       else
+               valuetoprint = value;
 
        switch (this->order) {
        case std::memory_order_relaxed: