nodestack: revert may_read_from to a normal member variable, not pointer
authorBrian Norris <banorris@uci.edu>
Tue, 3 Jul 2012 18:03:51 +0000 (11:03 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 3 Jul 2012 18:37:30 +0000 (11:37 -0700)
Because we don't control the 'new' operator for STL sets, I can't properly
ensure that it is allocated in non-snapshotting memory. So just make
may_read_from a normal member variable within class Node, so that its
initial 'allocation' is performed as part of the instantiation of its
subsuming Node object.

nodestack.cc
nodestack.h

index a39701eaf871c90a7da3b41e2f296421dd4d6186..d3b7c104316161d0268c8ae1b2db7a116fbbac74 100644 (file)
@@ -24,12 +24,10 @@ Node::Node(ModelAction *act, Node *par, int nthreads)
        explored_children(num_threads),
        backtrack(num_threads),
        numBacktracks(0),
-       may_read_from(NULL)
+       may_read_from()
 {
        if (act)
                act->set_node(this);
-       if (act && act->is_read())
-               may_read_from = new action_set_t();
 }
 
 /** @brief Node desctructor */
@@ -121,8 +119,7 @@ bool Node::is_enabled(Thread *t)
  */
 void Node::add_read_from(ModelAction *act)
 {
-       ASSERT(may_read_from);
-       may_read_from->insert(act);
+       may_read_from.insert(act);
 }
 
 void Node::explore(thread_id_t tid)
index 79ab19b3ac36fb805b66716a628dbcf389965ae6..37f9261149bc49a9d0a99182e21102be39e1161a 100644 (file)
@@ -61,7 +61,7 @@ private:
 
        /** The set of ModelActions that this the action at this Node may read
         *  from. Only meaningful if this Node represents a 'read' action. */
-       action_set_t *may_read_from;
+       action_set_t may_read_from;
 };
 
 typedef std::list<class Node *, MyAlloc< class Node * > > node_list_t;