From a0db445e3ecfedce6a85b7b381416b5c363a0614 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 1 Mar 2013 12:32:13 -0800 Subject: [PATCH] action: add get_write_value() --- action.cc | 19 +++++++++++++++++++ action.h | 1 + model.cc | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/action.cc b/action.cc index e6a621be..5f83c3f5 100644 --- 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; diff --git a/action.h b/action.h index 8a3650b6..c546f574 100644 --- 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; } diff --git a/model.cc b/model.cc index b10a841a..a66648bc 100644 --- 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(), }; -- 2.34.1