#include "action.h"
#include "nodestack.h"
#include "schedule.h"
+#include "snapshot-interface.h"
#include "common.h"
#define INITIAL_THREAD_ID 0
ModelChecker *model;
-void free_action_list(action_list_t *list)
-{
- action_list_t::iterator it;
- for (it = list->begin(); it != list->end(); it++)
- delete (*it);
- delete list;
-}
-
ModelChecker::ModelChecker()
:
/* Initialize default scheduler */
diverge(NULL),
nextThread(THREAD_ID_T_NONE),
action_trace(new action_list_t()),
+ thread_map(new std::map<int, class Thread *>),
node_stack(new NodeStack()),
next_backtrack(NULL)
{
ModelChecker::~ModelChecker()
{
std::map<int, class Thread *>::iterator it;
- for (it = thread_map.begin(); it != thread_map.end(); it++)
+ for (it = thread_map->begin(); it != thread_map->end(); it++)
delete (*it).second;
- thread_map.clear();
+ delete thread_map;
delete action_trace;
void ModelChecker::reset_to_initial_state()
{
DEBUG("+++ Resetting to initial state +++\n");
- std::map<int, class Thread *>::iterator it;
- for (it = thread_map.begin(); it != thread_map.end(); it++)
- delete (*it).second;
- thread_map.clear();
- delete action_trace;
- action_trace = new action_list_t();
node_stack->reset_execution();
current_action = NULL;
next_thread_id = INITIAL_THREAD_ID;
used_sequence_numbers = 0;
nextThread = 0;
next_backtrack = NULL;
- /* scheduler reset ? */
+ snapshotObject->backTrackBeforeStep(0);
}
thread_id_t ModelChecker::get_next_id()
Thread *t;
if (nextThread == THREAD_ID_T_NONE)
return NULL;
- t = thread_map[id_to_int(nextThread)];
+ t = (*thread_map)[id_to_int(nextThread)];
ASSERT(t != NULL);
int ModelChecker::add_thread(Thread *t)
{
- thread_map[id_to_int(t->get_id())] = t;
+ (*thread_map)[id_to_int(t->get_id())] = t;
scheduler->add_thread(t);
return 0;
}