From 72fd87546b318a6fe8016fb06c8a9015949450bb Mon Sep 17 00:00:00 2001 From: Brian Demsky Date: Fri, 27 Jul 2012 01:24:24 -0700 Subject: [PATCH] add some comments --- model.cc | 9 ++++++--- nodestack.cc | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/model.cc b/model.cc index 4c67b5a..02a4a6a 100644 --- a/model.cc +++ b/model.cc @@ -361,12 +361,12 @@ void ModelChecker::check_current_action(void) set_backtracking(curr); } -/** @returns whether the current trace is feasible. */ +/** @returns whether the current partial trace is feasible. */ bool ModelChecker::isfeasible() { return !cyclegraph->checkForCycles() && !failed_promise; } -/** Returns whether the current trace is feasible. */ +/** Returns whether the current completed trace is feasible. */ bool ModelChecker::isfinalfeasible() { return isfeasible() && promises->size()==0; } @@ -532,7 +532,7 @@ ClockVector * ModelChecker::get_cv(thread_id_t tid) { } -/** Resolve promises. */ +/** Resolve the given promises. */ void ModelChecker::resolve_promises(ModelAction *write) { for(unsigned int i=0, promise_index=0;promise_indexsize(); i++) { @@ -547,6 +547,9 @@ void ModelChecker::resolve_promises(ModelAction *write) { } } +/** Compute the set of promises that could potentially be satisfied by + * this action. */ + void ModelChecker::compute_promises(ModelAction *curr) { for(unsigned int i=0;isize();i++) { Promise * promise=(*promises)[i]; diff --git a/nodestack.cc b/nodestack.cc index 4ece182..6f7e6a2 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -57,16 +57,33 @@ void Node::print_may_read_from() (*it)->print(); } +/** This method sets a promise to explore meeting with the given + * node. + * @param i is the promise index. + */ + void Node::set_promise(uint32_t i) { if (i>=promises.size()) promises.resize(i+1,0); promises[i]=1; } +/** This method looks up whether a given promise should be satisfied + * by this node. + * + * @param i is the promise index. + * @return true if the promise should be satisfied by the given model action. + */ + bool Node::get_promise(uint32_t i) { return (promises[i]==2); } +/** This method increments to the next combination of promises. + * + * @return true if we have a valid combination. + */ + bool Node::increment_promise() { for (unsigned int i=0;i