X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=nodestack.cc;h=6295442606612f0feff684f3657756b167239628;hb=bdef0741b8a01e16946d261bc2a657af5a683b3e;hp=409c4e1e52ba431b729ec4b1c6d95168cfbc675b;hpb=1dbc6ce8102e79ead8c3ae09214126abab1b5c51;p=model-checker.git diff --git a/nodestack.cc b/nodestack.cc index 409c4e1..6295442 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -25,7 +25,9 @@ Node::Node(ModelAction *act, Node *par, int nthreads) backtrack(num_threads), numBacktracks(0), may_read_from(), - read_from_index(0) + read_from_index(0), + future_values(), + future_index(0) { if (act) act->set_node(this); @@ -55,6 +57,19 @@ void Node::print_may_read_from() (*it)->print(); } +/** + * Adds a value from a weakly ordered future write to backtrack to. + * @param value is the value to backtrack to. + */ + +void Node::add_future_value(uint64_t value) { + for(int i=0;i=may_read_from.size()); } +/** + * Checks whether the future_values set for this node is empty. + * @return true if the future_values set is empty. + */ + +bool Node::futurevalues_empty() { + return ((future_index+1)>=future_values.size()); +} + /** - * Mark the appropriate backtracking infromation for exploring a thread choice. + * Mark the appropriate backtracking information for exploring a thread choice. * @param act The ModelAction to explore */ void Node::explore_child(ModelAction *act) @@ -141,6 +165,17 @@ void Node::add_read_from(const ModelAction *act) may_read_from.push_back(act); } +/** + * Gets the next 'future_value' value from this Node. Only valid for a node + * where this->action is a 'read'. + * @return The first element in future_values + */ + +uint64_t Node::get_future_value() { + ASSERT(future_indexaction is a 'read'. @@ -162,6 +197,16 @@ bool Node::increment_read_from() { return (read_from_index