nodestack: add stub 'get_next_read_from()' function
authorBrian Norris <banorris@uci.edu>
Sat, 7 Jul 2012 01:12:59 +0000 (18:12 -0700)
committerBrian Norris <banorris@uci.edu>
Sat, 7 Jul 2012 02:04:34 +0000 (19:04 -0700)
This is the start of providing functional model-checking reads-from
relationships. It is a stub because it doesn't properly handle "backtracking"
and replay for reads-from assignments. It will simply return the first element
in may_read_from.

nodestack.cc
nodestack.h

index 10f7a72b5ef3ff5705fdbe29771def18212ecf11..2416ed7c5b35d23deadd2f2681cd890a926e7f98 100644 (file)
@@ -130,6 +130,22 @@ void Node::add_read_from(const ModelAction *act)
        may_read_from.push_back(act);
 }
 
+/**
+ * Gets the next 'may_read_from' action from this Node. Only valid for a node
+ * where this->action is a 'read'.
+ * @todo Perform reads_from backtracking/replay properly, so that this function
+ * may remove elements from may_read_from
+ * @return The first element in may_read_from
+ */
+const ModelAction * Node::get_next_read_from() {
+       const ModelAction *act;
+       ASSERT(!may_read_from.empty());
+       act = may_read_from.front();
+       /* TODO: perform reads_from replay properly */
+       /* may_read_from.pop_front(); */
+       return act;
+}
+
 void Node::explore(thread_id_t tid)
 {
        int i = id_to_int(tid);
index c09b628b4ffc9a8f91a7997f628f3234c1e6b7df..11cbdfa801d772d70e210668db374fd71f718b71 100644 (file)
@@ -44,6 +44,7 @@ public:
        Node * get_parent() const { return parent; }
 
        void add_read_from(const ModelAction *act);
+       const ModelAction * get_next_read_from();
 
        void print();
        void print_may_read_from();