Commit state of repository at time of OOPSLA 2015 submission.
[satcheck.git] / mcschedule.h
1 /*      Copyright (c) 2015 Regents of the University of California
2  *
3  *      Author: Brian Demsky <bdemsky@uci.edu>
4  *
5  *      This program is free software; you can redistribute it and/or
6  *      modify it under the terms of the GNU General Public License
7  *      version 2 as published by the Free Software Foundation.
8  */
9
10 #ifndef MCSCHEDULER_H
11 #define MCSCHEDULER_H
12 #include "classlist.h"
13 #include "mymemory.h"
14 #include "context.h"
15 #include "stl-model.h"
16
17 class WaitPair {
18  public:
19         WaitPair(ExecPoint * stoppoint, ExecPoint * waitpoint);
20         ~WaitPair();
21         ExecPoint * getStop();
22         ExecPoint * getWait();
23
24         MEMALLOC;
25  private:
26         ExecPoint *stop_point;
27         ExecPoint *wait_point;
28 };
29
30 class MCScheduler {
31  public:
32         MCScheduler(MCExecution * e);
33         ~MCScheduler();
34         ucontext_t * get_system_context() { return &system_context; }
35         void swap_threads(Thread * from, Thread *to);
36         void reset();
37         void check_preempt();
38 #ifdef TSO
39         bool check_store_buffer(unsigned int tid);
40 #endif
41         bool checkSet(unsigned int tid, ModelVector<ModelVector<WaitPair* > * > *set, unsigned int *setindex, ExecPoint *current);
42         bool check_thread(unsigned int tid);
43         void addWaitPair(EPRecord *stoprec, EPRecord *waitrec);
44         void setNewFlag();
45
46         MEMALLOC;
47  private:
48         unsigned int waitsetlen;
49         ucontext_t system_context;
50         MCExecution *execution;
51         ModelVector<ModelVector<WaitPair* > * > *waitset;
52         unsigned int * waitsetindex;
53 #ifdef TSO
54         ModelVector<ModelVector<WaitPair* > * > *storeset;
55         unsigned int * storesetindex;
56 #endif
57         bool newbehavior;
58 };
59
60
61 #endif