ModelChecker::ModelChecker() :
/* Initialize default scheduler */
params(),
- restart_flag(false),
scheduler(new Scheduler()),
history(new ModelHistory()),
execution(new ModelExecution(this, scheduler)),
* @return If there are more executions to explore, return true. Otherwise,
* return false.
*/
-bool ModelChecker::next_execution()
+void ModelChecker::finish_execution(bool more_executions)
{
DBG();
/* Is this execution a feasible execution that's worth bug-checking? */
else
clear_program_output();
- if (restart_flag) {
- do_restart();
- return true;
- }
// test code
execution_number ++;
- reset_to_initial_state();
+ if (more_executions)
+ reset_to_initial_state();
history->set_new_exec_flag();
- return false;
}
/** @brief Run trace analyses on complete trace */
return false;
}
-/** @brief Restart ModelChecker upon returning to the run loop of the
- * model checker. */
-void ModelChecker::restart()
-{
- restart_flag = true;
-}
-
-void ModelChecker::do_restart()
-{
- restart_flag = false;
- reset_to_initial_state();
- memset(&stats,0,sizeof(struct execution_stats));
- execution_number = 1;
-}
-
/** @brief Run ModelChecker for the user program */
void ModelChecker::run()
{
t->set_pending(NULL);
t = execution->take_step(curr);
} while (!should_terminate_execution());
- next_execution();
+ finish_execution((exec+1) < params.maxexecutions);
//restore random number generator state after rollback
setstate(random_state);
}
model_params * getParams();
void run();
- /** Restart the model checker, intended for pluggins. */
- void restart();
-
/** Exit the model checker, intended for pluggins. */
void exit_model_checker();
Scheduler * getScheduler() {return scheduler;}
MEMALLOC
private:
- /** Flag indicates whether to restart the model checker. */
- bool restart_flag;
-
/** Snapshot id we return to restart. */
snapshot_id snapshot;
unsigned int get_num_threads() const;
- bool next_execution();
+ void finish_execution(bool moreexecutions);
bool should_terminate_execution();
Thread * get_next_thread();
ModelVector<TraceAnalysis *> trace_analyses;
- /** @bref Implement restart. */
- void do_restart();
/** @bref Plugin that can inspect new actions. */
TraceAnalysis *inspect_plugin;
/** @brief The cumulative execution stats */