un-'const' some Promises
authorBrian Norris <banorris@uci.edu>
Wed, 27 Feb 2013 22:45:11 +0000 (14:45 -0800)
committerBrian Norris <banorris@uci.edu>
Thu, 28 Feb 2013 03:44:25 +0000 (19:44 -0800)
I need to modify this Promise sometimes, so don't make it const
everywhere.

action.cc
action.h
model.cc
nodestack.cc
nodestack.h

index 2390ecc7bd39f115380172075d14cd9e1c56cbe8..130902491a97f794f13e98b917bb84522e8b0f64 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -402,7 +402,7 @@ void ModelAction::set_read_from(const ModelAction *act)
  * Set this action's read-from promise
  * @param promise The promise to read from
  */
  * Set this action's read-from promise
  * @param promise The promise to read from
  */
-void ModelAction::set_read_from_promise(const Promise *promise)
+void ModelAction::set_read_from_promise(Promise *promise)
 {
        ASSERT(is_read());
        reads_from_promise = promise;
 {
        ASSERT(is_read());
        reads_from_promise = promise;
index 63c0375211c513ef704c4ee4c3fbb8abe832fdb5..87939f8c73512e84496016a3fe399edede067907 100644 (file)
--- a/action.h
+++ b/action.h
@@ -81,13 +81,13 @@ public:
        modelclock_t get_seq_number() const { return seq_number; }
        uint64_t get_value() const { return value; }
        const ModelAction * get_reads_from() const { return reads_from; }
        modelclock_t get_seq_number() const { return seq_number; }
        uint64_t get_value() const { return value; }
        const ModelAction * get_reads_from() const { return reads_from; }
-       const Promise * get_reads_from_promise() const { return reads_from_promise; }
+       Promise * get_reads_from_promise() const { return reads_from_promise; }
 
        Node * get_node() const;
        void set_node(Node *n) { node = n; }
 
        void set_read_from(const ModelAction *act);
 
        Node * get_node() const;
        void set_node(Node *n) { node = n; }
 
        void set_read_from(const ModelAction *act);
-       void set_read_from_promise(const Promise *promise);
+       void set_read_from_promise(Promise *promise);
 
        /** Store the most recent fence-release from the same thread
         *  @param fence The fence-release that occured prior to this */
 
        /** Store the most recent fence-release from the same thread
         *  @param fence The fence-release that occured prior to this */
@@ -175,7 +175,7 @@ private:
        const ModelAction *reads_from;
 
        /** The promise that this action reads from. Only valid for reads */
        const ModelAction *reads_from;
 
        /** The promise that this action reads from. Only valid for reads */
-       const Promise *reads_from_promise;
+       Promise *reads_from_promise;
 
        /** The last fence release from the same thread */
        const ModelAction *last_fence_release;
 
        /** The last fence release from the same thread */
        const ModelAction *last_fence_release;
index cb53e118b73231b643964edb2fe0a8782da984b7..44fba7eabc84839bc71bc64e7b69f18bb123b676 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -872,7 +872,7 @@ bool ModelChecker::process_read(ModelAction *curr)
                        break;
                }
                case READ_FROM_PROMISE: {
                        break;
                }
                case READ_FROM_PROMISE: {
-                       const Promise *promise = curr->get_node()->get_read_from_promise();
+                       Promise *promise = curr->get_node()->get_read_from_promise();
                        value = promise->get_value();
                        curr->set_read_from_promise(promise);
                        mo_graph->startChanges();
                        value = promise->get_value();
                        curr->set_read_from_promise(promise);
                        mo_graph->startChanges();
index 131b06ca6fe1d190ed56f74577676cc81cc3b069..e6f0269c0c2720a09d1c74882cb597a8afefd044 100644 (file)
@@ -455,7 +455,7 @@ void Node::add_read_from_promise(const ModelAction *reader)
  * where this->action is a 'read'.
  * @return The current element in read_from_promises
  */
  * where this->action is a 'read'.
  * @return The current element in read_from_promises
  */
-const Promise * Node::get_read_from_promise() const
+Promise * Node::get_read_from_promise() const
 {
        if (read_from_promise_idx < 0 || read_from_promise_idx >= ((int)read_from_promises.size()))
                return NULL;
 {
        if (read_from_promise_idx < 0 || read_from_promise_idx >= ((int)read_from_promises.size()))
                return NULL;
index fc566d6dde8fd65561888899c3505babd79804b0..f478db2841917edd170cd7d0649c5acdbd6a23ef 100644 (file)
@@ -75,7 +75,7 @@ public:
        int get_read_from_past_size() const;
 
        void add_read_from_promise(const ModelAction *reader);
        int get_read_from_past_size() const;
 
        void add_read_from_promise(const ModelAction *reader);
-       const Promise * get_read_from_promise() const;
+       Promise * get_read_from_promise() const;
 
        bool add_future_value(struct future_value fv);
        struct future_value get_future_value() const;
 
        bool add_future_value(struct future_value fv);
        struct future_value get_future_value() const;