From a91144758ab80e865e5227c236e368fc0d3d77a9 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 23 Jan 2013 10:41:23 -0800 Subject: [PATCH] nodestack: eliminate get_future_value_expiration() We don't need separate accessors for each member of 'struct future_value'. Just pass the entire struct. --- model.cc | 6 +++--- nodestack.cc | 14 ++++---------- nodestack.h | 3 +-- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/model.cc b/model.cc index 94f68e2..017455d 100644 --- 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); diff --git a/nodestack.cc b/nodestack.cc index a4d2b1a..708ec3d 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -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 diff --git a/nodestack.h b/nodestack.h index dc872c7..55991c3 100644 --- a/nodestack.h +++ b/nodestack.h @@ -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; -- 2.34.1