action: add get_write_value()
authorBrian Norris <banorris@uci.edu>
Fri, 1 Mar 2013 20:32:13 +0000 (12:32 -0800)
committerBrian Norris <banorris@uci.edu>
Fri, 1 Mar 2013 21:14:40 +0000 (13:14 -0800)
action.cc
action.h
model.cc

index e6a621be6ec4222b25190a52e7c5ebf97533bce6..5f83c3f5604524692e88e1c9478db7bb9f7216fc 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -397,6 +397,23 @@ uint64_t ModelAction::get_reads_from_value() const
        return reads_from_promise->get_value();
 }
 
+/**
+ * @brief Get the value written by this store
+ *
+ * We differentiate this function from ModelAction::get_reads_from_value and
+ * ModelAction::get_value for the purpose of RMW's, which may have both a
+ * 'read' and a 'write' value.
+ *
+ * Note: 'this' must be a store.
+ *
+ * @return The value written by this store
+ */
+uint64_t ModelAction::get_write_value() const
+{
+       ASSERT(is_write());
+       return value;
+}
+
 /** @return The Node associated with this ModelAction */
 Node * ModelAction::get_node() const
 {
@@ -532,6 +549,8 @@ void ModelAction::print() const
        uint64_t valuetoprint;
        if (is_read())
                valuetoprint = get_reads_from_value();
+       else if (is_write())
+               valuetoprint = get_write_value();
        else
                valuetoprint = value;
 
index 8a3650b64c8e1ad8103d6767522a4aa36c56f879..c546f574202523b7ba0a575e34d6ac20182112a2 100644 (file)
--- a/action.h
+++ b/action.h
@@ -81,6 +81,7 @@ public:
        modelclock_t get_seq_number() const { return seq_number; }
        uint64_t get_value() const { return value; }
        uint64_t get_reads_from_value() const;
+       uint64_t get_write_value() const;
        const ModelAction * get_reads_from() const { return reads_from; }
        Promise * get_reads_from_promise() const { return reads_from_promise; }
 
index b10a841a3fdece2304fe405dfcf02de1c6856400..a66648bce12064d9c6730dc845f8292f277e97f6 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -1022,7 +1022,7 @@ void ModelChecker::add_future_value(const ModelAction *writer, ModelAction *read
                        write_thread = write_thread->get_parent();
 
                struct future_value fv = {
-                       writer->get_value(),
+                       writer->get_write_value(),
                        writer->get_seq_number() + params.maxfuturedelay,
                        write_thread->get_id(),
                };