model: convert 'action_trace' to pointer
authorBrian Norris <banorris@uci.edu>
Thu, 19 Apr 2012 19:56:21 +0000 (12:56 -0700)
committerBrian Norris <banorris@uci.edu>
Thu, 19 Apr 2012 19:56:21 +0000 (12:56 -0700)
We need to swap out this list with a new one when we reset, and we want to
retain references to this list easily, so make the ModelChecker::action_trace
member into a pointer to a list.

model.cc
model.h

index 6493022e090670e3c5dde9c0cbf924a9f2abc5f5..adc47cd058b00f43262060bf8832b13a8bff5f9d 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -17,10 +17,12 @@ ModelChecker::ModelChecker()
 
        rootNode = new TreeNode(NULL);
        currentNode = rootNode;
+       action_trace = new std::list<class ModelAction *>();
 }
 
 ModelChecker::~ModelChecker()
 {
+       delete action_trace;
        delete this->scheduler;
        delete rootNode;
 }
@@ -52,7 +54,7 @@ ModelAction *ModelChecker::get_last_conflict(ModelAction *act)
                        break;
        }
        std::list<class ModelAction *>::reverse_iterator rit;
-       for (rit = action_trace.rbegin(); rit != action_trace.rend(); rit++) {
+       for (rit = action_trace->rbegin(); rit != action_trace->rend(); rit++) {
                ModelAction *prev = *rit;
                if (prev->get_location() != loc)
                        continue;
@@ -105,7 +107,7 @@ void ModelChecker::check_current_action(void)
        next->set_node(currentNode);
        set_backtracking(next);
        currentNode = currentNode->exploreChild(next->get_tid());
-       this->action_trace.push_back(next);
+       this->action_trace->push_back(next);
 }
 
 void ModelChecker::print_trace(void)
@@ -116,7 +118,7 @@ void ModelChecker::print_trace(void)
        printf("---------------------------------------------------------------------\n");
        printf("Total nodes created: %d\n\n", TreeNode::getTotalNodes());
 
-       for (it = action_trace.begin(); it != action_trace.end(); it++) {
+       for (it = action_trace->begin(); it != action_trace->end(); it++) {
                DBG();
                (*it)->print();
        }
diff --git a/model.h b/model.h
index 152d83c3d633efb1d9185d6201605fdefba3c5c6..b62ab80a1b490fbbda331a7f0c1fbac09540bf1a 100644 (file)
--- a/model.h
+++ b/model.h
@@ -65,7 +65,7 @@ public:
 private:
        int used_thread_id;
        class ModelAction *current_action;
-       std::list<class ModelAction *> action_trace;
+       std::list<class ModelAction *> *action_trace;
        std::map<thread_id_t, class Thread *> thread_map;
        class TreeNode *rootNode, *currentNode;
 };