Construct the graph of methods based on the order that methods are called, rather...
[c11tester.git] / newfuzzer.h
1 #ifndef __NEWFUZZER_H__
2 #define __NEWFUZZER_H__
3
4 #include "fuzzer.h"
5 #include "classlist.h"
6 #include "mymemory.h"
7 #include "stl-model.h"
8
9 typedef HashTable<FuncInst *, ModelAction *, uintptr_t, 0> inst_act_map_t;
10
11 class NewFuzzer : public Fuzzer {
12 public:
13         NewFuzzer();
14         int selectWrite(ModelAction *read, SnapVector<ModelAction *>* rf_set);
15         Predicate * get_selected_child_branch(thread_id_t tid);
16         void conditional_sleep(Thread * thread);
17         bool has_paused_threads();
18         void wake_up_paused_threads(int * threadlist, int * numthreads);
19
20         Thread * selectThread(int * threadlist, int numthreads);
21         Thread * selectNotify(action_list_t * waiters);
22         bool shouldSleep(const ModelAction * sleep);
23         bool shouldWake(const ModelAction * sleep);
24         bool shouldWait(const ModelAction * wait);
25
26         void register_engine(ModelHistory * history, ModelExecution * execution);
27
28         SNAPSHOTALLOC
29 private:
30         ModelHistory * history;
31         ModelExecution * execution;
32
33         SnapVector<ModelAction *> thrd_last_read_act;
34         SnapVector<Predicate *> thrd_curr_pred;
35         SnapVector<Predicate *> thrd_selected_child_branch;
36         SnapVector< SnapVector<ModelAction *> *> thrd_pruned_writes;
37
38         bool prune_writes(thread_id_t tid, Predicate * pred, SnapVector<ModelAction *> * rf_set, inst_act_map_t * inst_act_map);
39         Predicate * selectBranch(thread_id_t tid, Predicate * curr_pred, FuncInst * read_inst);
40
41         /* Threads put to sleep by NewFuzzer because no writes in rf_set satisfies the selected predicate.
42          * Only used by selectWrite;
43          */
44         SnapVector<Thread *> paused_thread_set;
45 };
46
47 #endif /* end of __NEWFUZZER_H__ */