X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=blobdiff_plain;f=execution.h;h=2ca25131a013166b7fdc76e53f75afdc4969c888;hp=6810fee665a6b018cbec1c353b12f22667a8c42e;hb=6014243b7130f34b7ffd1098da225b0b8de5c328;hpb=7d4142d82bfa30baa4452430268a9a337eff3fbf diff --git a/execution.h b/execution.h index 6810fee..2ca2513 100644 --- a/execution.h +++ b/execution.h @@ -14,7 +14,6 @@ #include "config.h" #include "modeltypes.h" #include "stl-model.h" -#include "context.h" #include "params.h" /* Forward declaration */ @@ -61,9 +60,14 @@ struct release_seq { /** @brief The central structure for model-checking */ class ModelExecution { public: - ModelExecution(struct model_params *params, Scheduler *scheduler, NodeStack *node_stack); + ModelExecution(ModelChecker *m, + const struct model_params *params, + Scheduler *scheduler, + NodeStack *node_stack); ~ModelExecution(); + const struct model_params * get_params() const { return params; } + Thread * take_step(ModelAction *curr); void fixup_release_sequences(); @@ -105,16 +109,19 @@ public: bool is_feasible_prefix_ignore_relseq() const; bool is_infeasible() const; bool is_deadlocked() const; + bool is_yieldblocked() const; bool too_many_steps() const; ModelAction * get_next_backtrack(); - action_list_t * get_action_trace() const { return action_trace; } - - void increment_execution_number() { execution_number++; } + action_list_t * get_action_trace() { return &action_trace; } - MEMALLOC + SNAPSHOTALLOC private: + int get_execution_number() const; + + ModelChecker *model; + const model_params * const params; /** The scheduler to use: tracks the running/ready Threads */ @@ -134,7 +141,7 @@ private: ModelAction * check_current_action(ModelAction *curr); bool initialize_curr_action(ModelAction **curr); bool process_read(ModelAction *curr); - bool process_write(ModelAction *curr); + bool process_write(ModelAction *curr, work_queue_t *work); bool process_fence(ModelAction *curr); bool process_mutex(ModelAction *curr); bool process_thread_action(ModelAction *curr); @@ -153,7 +160,8 @@ private: void set_backtracking(ModelAction *act); bool set_latest_backtrack(ModelAction *act); Promise * pop_promise_to_resolve(const ModelAction *curr); - bool resolve_promise(ModelAction *curr, Promise *promise); + bool resolve_promise(ModelAction *curr, Promise *promise, + work_queue_t *work); void compute_promises(ModelAction *curr); void compute_relseq_breakwrites(ModelAction *curr); @@ -176,25 +184,33 @@ private: bool w_modification_order(ModelAction *curr, ModelVector *send_fv); void get_release_seq_heads(ModelAction *acquire, ModelAction *read, rel_heads_list_t *release_heads); bool release_seq_heads(const ModelAction *rf, rel_heads_list_t *release_heads, struct release_seq *pending) const; + void propagate_clockvector(ModelAction *acquire, work_queue_t *work); bool resolve_release_sequences(void *location, work_queue_t *work_queue); void add_future_value(const ModelAction *writer, ModelAction *reader); - + bool check_coherence_promise(const ModelAction *write, const ModelAction *read); ModelAction * get_uninitialized_action(const ModelAction *curr) const; - action_list_t * const action_trace; - HashTable * const thread_map; + action_list_t action_trace; + SnapVector thread_map; /** Per-object list of actions. Maps an object (i.e., memory location) * to a trace of all actions performed on the object. */ - HashTable * const obj_map; + HashTable obj_map; /** Per-object list of actions. Maps an object (i.e., memory location) * to a trace of all actions performed on the object. */ - HashTable * const condvar_waiters_map; + HashTable condvar_waiters_map; - HashTable *, uintptr_t, 4 > * const obj_thrd_map; - SnapVector * const promises; - SnapVector * const futurevalues; + HashTable *, uintptr_t, 4> obj_thrd_map; + + /** + * @brief List of currently-pending promises + * + * Promises are sorted by the execution order of the read(s) which + * created them + */ + SnapVector promises; + SnapVector futurevalues; /** * List of pending release sequences. Release sequences might be @@ -202,10 +218,10 @@ private: * are established. Each entry in the list may only be partially * filled, depending on its pending status. */ - SnapVector * const pending_rel_seqs; + SnapVector pending_rel_seqs; - SnapVector * const thrd_last_action; - SnapVector * const thrd_last_fence_release; + SnapVector thrd_last_action; + SnapVector thrd_last_fence_release; NodeStack * const node_stack; /** A special model-checker Thread; used for associating with @@ -232,8 +248,6 @@ private: */ CycleGraph * const mo_graph; - int execution_number; - Thread * action_select_next_thread(const ModelAction *curr) const; };