From cad3394ea130ccd3458f12014b77c115739048e4 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 3 Jul 2012 11:03:51 -0700 Subject: [PATCH 1/1] nodestack: revert may_read_from to a normal member variable, not pointer 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 | 7 ++----- nodestack.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/nodestack.cc b/nodestack.cc index a39701e..d3b7c10 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -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) diff --git a/nodestack.h b/nodestack.h index 79ab19b..37f9261 100644 --- a/nodestack.h +++ b/nodestack.h @@ -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 > node_list_t; -- 2.34.1