model: reformat/refactor some code
[c11tester.git] / model.h
diff --git a/model.h b/model.h
index 41ec97b50bdb71744075d0216a4bb209813255a9..dc6ef6add21045042ed42a29882e3ad9a38ac34e 100644 (file)
--- a/model.h
+++ b/model.h
@@ -23,10 +23,17 @@ class NodeStack;
 class CycleGraph;
 class Promise;
 
+/**
+ * Model checker parameter structure. Holds run-time configuration options for
+ * the model checker.
+ */
+struct model_params {
+};
+
 /** @brief The central structure for model-checking */
 class ModelChecker {
 public:
-       ModelChecker();
+       ModelChecker(struct model_params params);
        ~ModelChecker();
 
        /** The scheduler to use: tracks the running/ready Threads */
@@ -42,7 +49,10 @@ public:
        ucontext_t * get_system_context(void) { return system_context; }
 
        void check_current_action(void);
-       void print_summary(void);
+
+       /** Prints an execution summary with trace information. */
+       void print_summary();
+
        Thread * schedule_next_thread();
 
        int add_thread(Thread *t);
@@ -57,6 +67,8 @@ public:
        ClockVector * get_cv(thread_id_t tid);
        bool next_execution();
        bool isfeasible();
+       bool isfinalfeasible();
+       void check_promises(ClockVector *old_cv, ClockVector * merge_cv);
 
        MEMALLOC
 private:
@@ -64,6 +76,8 @@ private:
        modelclock_t used_sequence_numbers;
        int num_executions;
 
+       const model_params params;
+
        /**
         * Stores the ModelAction for the current thread action.  Call this
         * immediately before switching from user- to system-context to pass
@@ -77,6 +91,8 @@ private:
        thread_id_t get_next_replay_thread();
        ModelAction * get_next_backtrack();
        void reset_to_initial_state();
+       void resolve_promises(ModelAction *curr);
+       void compute_promises(ModelAction *curr);
 
        void add_action_to_lists(ModelAction *act);
        ModelAction * get_last_action(thread_id_t tid);
@@ -84,10 +100,10 @@ private:
        ModelAction * get_last_seq_cst(const void *location);
        void build_reads_from_past(ModelAction *curr);
        ModelAction * process_rmw(ModelAction * curr);
+       void post_r_modification_order(ModelAction * curr, const ModelAction *rf);
        void r_modification_order(ModelAction * curr, const ModelAction *rf);
        void w_modification_order(ModelAction * curr);
 
-
        ModelAction *current_action;
        ModelAction *diverge;
        thread_id_t nextThread;
@@ -106,6 +122,7 @@ private:
        NodeStack *node_stack;
        ModelAction *next_backtrack;
        CycleGraph * cyclegraph;
+       bool failed_promise;
 };
 
 extern ModelChecker *model;