nodestack: eliminate get_future_value_expiration()
authorBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 18:41:23 +0000 (10:41 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 23 Jan 2013 18:41:40 +0000 (10:41 -0800)
We don't need separate accessors for each member of 'struct
future_value'. Just pass the entire struct.

model.cc
nodestack.cc
nodestack.h

index 94f68e204ec5fe8331c770651add988d4cd980af..017455d24124c726ddd5164c508feaab3bd2b24f 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -735,10 +735,10 @@ bool ModelChecker::process_read(ModelAction *curr, bool second_part_of_rmw)
                        updated |= r_status;
                } else if (!second_part_of_rmw) {
                        /* Read from future value */
-                       value = curr->get_node()->get_future_value();
-                       modelclock_t expiration = curr->get_node()->get_future_value_expiration();
+                       struct future_value fv = curr->get_node()->get_future_value();
+                       value = fv.value;
                        curr->set_read_from(NULL);
-                       Promise *valuepromise = new Promise(curr, value, expiration);
+                       Promise *valuepromise = new Promise(curr, value, fv.expiration);
                        promises->push_back(valuepromise);
                }
                get_thread(curr)->set_return_value(value);
index a4d2b1a491a989cb094f8709d2d3ca19e2687b0e..708ec3d0f5fa3da43a563228ef53c4b6e72475dd 100644 (file)
@@ -381,20 +381,14 @@ void Node::add_read_from(const ModelAction *act)
 }
 
 /**
- * Gets the next 'future_value' value from this Node. Only valid for a node
- * where this->action is a 'read'.
+ * Gets the next 'future_value' from this Node. Only valid for a node where
+ * this->action is a 'read'.
  * @return The first element in future_values
  */
-uint64_t Node::get_future_value() const
-{
-       ASSERT(future_index >= 0 && future_index < ((int)future_values.size()));
-       return future_values[future_index].value;
-}
-
-modelclock_t Node::get_future_value_expiration() const
+struct future_value Node::get_future_value() const
 {
        ASSERT(future_index >= 0 && future_index < ((int)future_values.size()));
-       return future_values[future_index].expiration;
+       return future_values[future_index];
 }
 
 int Node::get_read_from_size() const
index dc872c740b9ea021ea9fb3261af8fc62aa4bf2ac..55991c3022a50dc67e51ca607f3ca33e3e638ce2 100644 (file)
@@ -77,8 +77,7 @@ public:
        Node * get_parent() const { return parent; }
 
        bool add_future_value(uint64_t value, modelclock_t expiration);
-       uint64_t get_future_value() const;
-       modelclock_t get_future_value_expiration() const;
+       struct future_value get_future_value() const;
        bool increment_future_value();
        bool future_value_empty() const;