#include <new>
#include <stdarg.h>
+#include "model.h"
#include "execution.h"
#include "action.h"
#include "nodestack.h"
};
/** @brief Constructor */
-ModelExecution::ModelExecution(struct model_params *params, Scheduler *scheduler, NodeStack *node_stack) :
+ModelExecution::ModelExecution(ModelChecker *m,
+ struct model_params *params,
+ Scheduler *scheduler,
+ NodeStack *node_stack) :
+ model(m),
params(params),
scheduler(scheduler),
action_trace(new action_list_t()),
thrd_last_fence_release(new SnapVector<ModelAction *>()),
node_stack(node_stack),
priv(new struct model_snapshot_members()),
- mo_graph(new CycleGraph()),
- execution_number(1)
+ mo_graph(new CycleGraph())
{
/* Initialize a model-checker thread, for special ModelActions */
model_thread = new Thread(get_next_id());
delete priv;
}
+int ModelExecution::get_execution_number() const
+{
+ return model->get_execution_number();
+}
+
static action_list_t * get_safe_ptr_action(HashTable<const void *, action_list_t *, uintptr_t, 4> * hash, void * ptr)
{
action_list_t *tmp = hash->get(ptr);
{
#if SUPPORT_MOD_ORDER_DUMP
char buffername[100];
- sprintf(buffername, "exec%04u", execution_number);
+ sprintf(buffername, "exec%04u", get_execution_number());
mo_graph->dumpGraphToFile(buffername);
- sprintf(buffername, "graph%04u", execution_number);
+ sprintf(buffername, "graph%04u", get_execution_number());
dumpGraph(buffername);
#endif
- model_print("Execution %d:", execution_number);
+ model_print("Execution %d:", get_execution_number());
if (isfeasibleprefix()) {
if (scheduler->all_threads_sleeping())
model_print(" SLEEP-SET REDUNDANT");
/** @brief The central structure for model-checking */
class ModelExecution {
public:
- ModelExecution(struct model_params *params, Scheduler *scheduler, NodeStack *node_stack);
+ ModelExecution(ModelChecker *m,
+ struct model_params *params,
+ Scheduler *scheduler,
+ NodeStack *node_stack);
~ModelExecution();
Thread * take_step(ModelAction *curr);
action_list_t * get_action_trace() const { return action_trace; }
- void increment_execution_number() { execution_number++; }
-
MEMALLOC
private:
+ int get_execution_number() const;
+
+ ModelChecker *model;
+
const model_params * const params;
/** The scheduler to use: tracks the running/ready Threads */
*/
CycleGraph * const mo_graph;
- int execution_number;
-
Thread * action_select_next_thread(const ModelAction *curr) const;
};
params(params),
scheduler(new Scheduler()),
node_stack(new NodeStack()),
- execution(new ModelExecution(¶ms, scheduler, node_stack)),
+ execution(new ModelExecution(this, ¶ms, scheduler, node_stack)),
+ execution_number(1),
diverge(NULL),
earliest_diverge(NULL),
trace_analyses()
diverge->print();
}
- execution->increment_execution_number();
+ execution_number++;
+
reset_to_initial_state();
return true;
}
const ModelExecution * get_execution() const { return execution; }
+ int get_execution_number() const { return execution_number; }
+
Thread * get_thread(thread_id_t tid) const;
Thread * get_thread(const ModelAction *act) const;
NodeStack * const node_stack;
ModelExecution *execution;
+ int execution_number;
+
void execute_sleep_set();
bool next_execution();