X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=nodestack.cc;h=80bf5c41bf1d1721e20ad7d6d38fe7f141ed869f;hb=e7e175a74d95b5ed0a50750453168275f2fa3589;hp=2fa87841f893ea6aace1a1acd055b20e34958b47;hpb=73ba97016012e678ba1ad7d45970265470501b61;p=model-checker.git diff --git a/nodestack.cc b/nodestack.cc index 2fa8784..80bf5c4 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -9,6 +9,7 @@ #include "model.h" #include "threads-model.h" #include "modeltypes.h" +#include "execution.h" /** * @brief Node constructor @@ -726,6 +727,27 @@ bool Node::relseq_break_empty() const /******************* end breaking release sequences ***************************/ +/** + * Increments some behavior's index, if a new behavior is available + * @return True if there is a new behavior available; otherwise false + */ +bool Node::increment_behaviors() +{ + /* satisfy a different misc_index values */ + if (increment_misc()) + return true; + /* satisfy a different set of promises */ + if (increment_promise()) + return true; + /* read from a different value */ + if (increment_read_from()) + return true; + /* resolve a release sequence differently */ + if (increment_relseq_break()) + return true; + return false; +} + NodeStack::NodeStack() : node_list(), head_idx(-1), @@ -740,6 +762,15 @@ NodeStack::~NodeStack() delete node_list[i]; } +/** + * @brief Register the model-checker object with this NodeStack + * @param exec The execution structure for the ModelChecker + */ +void NodeStack::register_engine(const ModelExecution *exec) +{ + this->execution = exec; +} + void NodeStack::print() const { model_print("............................................\n"); @@ -772,7 +803,7 @@ ModelAction * NodeStack::explore_action(ModelAction *act, enabled_type_t *is_ena prevfairness = node_list[head_idx - model->params.fairwindow]; } - int next_threads = model->get_num_threads(); + int next_threads = execution->get_num_threads(); if (act->get_type() == THREAD_CREATE) next_threads++; node_list.push_back(new Node(act, head, next_threads, prevfairness));