fix bug by changing MEMALLOC to SNAPSHOTALLOC
[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 * selectBranch(thread_id_t tid, Predicate * curr_pred, FuncInst * read_inst);
16         Predicate * get_selected_child_branch(thread_id_t tid);
17         bool prune_writes(thread_id_t tid, Predicate * pred, SnapVector<ModelAction *> * rf_set, inst_act_map_t * inst_act_map);
18
19         Thread * selectThread(int * threadlist, int numthreads);
20         Thread * selectNotify(action_list_t * waiters);
21         bool shouldSleep(const ModelAction *sleep);
22         bool shouldWake(const ModelAction *sleep);
23
24         void register_engine(ModelHistory * history, ModelExecution * execution);
25
26         SNAPSHOTALLOC
27 private:
28         ModelHistory * history;
29         ModelExecution * execution;
30
31         SnapVector<ModelAction *> thrd_last_read_act;
32         SnapVector<Predicate *> thrd_curr_pred;
33         SnapVector<Predicate *> thrd_selected_child_branch;
34         SnapVector< SnapVector<ModelAction *> *> thrd_pruned_writes;
35 };
36
37 #endif /* end of __NEWFUZZER_H__ */