nodestack: push 'create_cv' functionality responsibility back to ModelChecker
authorBrian Norris <banorris@uci.edu>
Tue, 29 May 2012 17:46:42 +0000 (10:46 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 29 May 2012 21:39:22 +0000 (14:39 -0700)
It doesn't really make sense to have NodeStack call the 'create_cv' function
for a ModelAction. This commit separates the functionality of 'explore_action'
from 'create_cv', calling each separately from the higher-level
'check_current_action' model-checking function.

action.cc
model.cc
nodestack.cc
nodestack.h

index d76796d..28d9527 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -84,7 +84,9 @@ bool ModelAction::is_dependent(ModelAction *act)
 
 void ModelAction::create_cv(ModelAction *parent)
 {
-       ASSERT(cv == NULL);
+       if (cv)
+               return;
+
        if (parent)
                cv = new ClockVector(parent->cv, this);
        else
index 274a2d9..2ffa22a 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -211,7 +211,8 @@ void ModelChecker::check_current_action(void)
                return;
        }
 
-       curr = node_stack->explore_action(curr, get_parent_action(curr->get_tid()));
+       curr = node_stack->explore_action(curr);
+       curr->create_cv(get_parent_action(curr->get_tid()));
 
        /* Assign 'creation' parent */
        if (curr->get_type() == THREAD_CREATE) {
index 2eba02c..df5fc63 100644 (file)
@@ -117,7 +117,7 @@ void NodeStack::print()
        printf("............................................\n");
 }
 
-ModelAction * NodeStack::explore_action(ModelAction *act, ModelAction *parent)
+ModelAction * NodeStack::explore_action(ModelAction *act)
 {
        DBG();
 
@@ -135,7 +135,6 @@ ModelAction * NodeStack::explore_action(ModelAction *act, ModelAction *parent)
 
                /* Record action */
                get_head()->explore_child(act);
-               act->create_cv(parent);
                node_list.push_back(new Node(act, model->get_num_threads()));
                iter++;
        }
index af78082..cf3c6db 100644 (file)
@@ -45,7 +45,7 @@ class NodeStack {
 public:
        NodeStack();
        ~NodeStack();
-       ModelAction * explore_action(ModelAction *act, ModelAction *parent);
+       ModelAction * explore_action(ModelAction *act);
        Node * get_head();
        Node * get_next();
        void reset_execution();