Node *currnode;
ModelAction *curr = this->current_action;
+ ModelAction *tmp;
current_action = NULL;
if (!curr) {
DEBUG("trying to push NULL action...\n");
return;
}
- curr = node_stack->explore_action(curr);
- curr->create_cv(get_parent_action(curr->get_tid()));
+ tmp = node_stack->explore_action(curr);
+ if (tmp) {
+ /* Discard duplicate ModelAction */
+ delete curr;
+ curr = tmp;
+ } else {
+ curr->create_cv(get_parent_action(curr->get_tid()));
+ }
/* Assign 'creation' parent */
if (curr->get_type() == THREAD_CREATE) {
ASSERT(!node_list.empty());
if (get_head()->has_been_explored(act->get_tid())) {
- /* Discard duplicate ModelAction */
- delete act;
- iter++;
- } else { /* Diverging from previous execution */
- /* Clear out remainder of list */
- node_list_t::iterator it = iter;
- it++;
- clear_node_list(&node_list, it, node_list.end());
-
- /* Record action */
- get_head()->explore_child(act);
- node_list.push_back(new Node(act, model->get_num_threads()));
- total_nodes++;
iter++;
+ return (*iter)->get_action();
}
- return (*iter)->get_action();
+
+ /* Diverging from previous execution; clear out remainder of list */
+ node_list_t::iterator it = iter;
+ it++;
+ clear_node_list(&node_list, it, node_list.end());
+
+ /* Record action */
+ get_head()->explore_child(act);
+ node_list.push_back(new Node(act, model->get_num_threads()));
+ total_nodes++;
+ iter++;
+ return NULL;
}
Node * NodeStack::get_head()