Able to evaluate predicate expression against a 'context' and generate concrete predi...
[c11tester.git] / newfuzzer.h
index f50c47651fa01ded23ec65db13d951edf2e543c0..d6fa3a4fba861915d0e6cd87e615405d38898158 100644 (file)
@@ -8,19 +8,40 @@
 
 class NewFuzzer : public Fuzzer {
 public:
-       NewFuzzer() {}
+       NewFuzzer();
        int selectWrite(ModelAction *read, SnapVector<ModelAction *>* rf_set);
+       Predicate * get_selected_child_branch(thread_id_t tid);
+       bool has_paused_threads();
+
        Thread * selectThread(int * threadlist, int numthreads);
        Thread * selectNotify(action_list_t * waiters);
-       bool shouldSleep(const ModelAction *sleep);
-       bool shouldWake(const ModelAction *sleep);
+       bool shouldSleep(const ModelAction * sleep);
+       bool shouldWake(const ModelAction * sleep);
+       bool shouldWait(const ModelAction * wait);
 
        void register_engine(ModelHistory * history, ModelExecution * execution);
 
-       MEMALLOC
+       SNAPSHOTALLOC
 private:
        ModelHistory * history;
        ModelExecution * execution;
+
+       SnapVector<ModelAction *> thrd_last_read_act;
+       SnapVector<Predicate *> thrd_curr_pred;
+       SnapVector<Predicate *> thrd_selected_child_branch;
+       SnapVector< SnapVector<ModelAction *> *> thrd_pruned_writes;
+
+       bool prune_writes(thread_id_t tid, Predicate * pred, SnapVector<ModelAction *> * rf_set, inst_act_map_t * inst_act_map);
+       Predicate * selectBranch(thread_id_t tid, Predicate * curr_pred, FuncInst * read_inst);
+
+       /* Threads put to sleep by NewFuzzer because no writes in rf_set satisfies the selected predicate.
+        * Only used by selectWrite;
+        */
+       SnapVector<Thread *> paused_thread_set;
+
+       void conditional_sleep(Thread * thread);
+       void wake_up_paused_threads(int * threadlist, int * numthreads);
+       bool notify_conditional_sleep(Thread * thread);
 };
 
 #endif /* end of __NEWFUZZER_H__ */