-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathsingleThreadedLifter.ml
More file actions
74 lines (60 loc) · 1.79 KB
/
singleThreadedLifter.ml
File metadata and controls
74 lines (60 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
(** This lifter takes an analysis that only works for single-threaded code and allows it to run on multi-threaded programs by returning top when the code might be multi-threaded.
*)
open Analyses
module SingleThreadedLifter (S: MCPSpec) =
struct
include S
let is_multithreaded = ThreadFlag.has_ever_been_multi
let query ctx =
let return_top (type a) (q: a Queries.t) =
Queries.Result.top q
in
if is_multithreaded (ask_of_man ctx) then
return_top
else
query ctx
let assign ctx lval expr =
if is_multithreaded (ask_of_man ctx) then
D.top ()
else
assign ctx lval expr
let branch ctx e pos =
if is_multithreaded (ask_of_man ctx) then
D.top ()
else
branch ctx e pos
let body ctx f =
if is_multithreaded (ask_of_man ctx) then
D.top ()
else
body ctx f
let return ctx exp_opt f =
if is_multithreaded (ask_of_man ctx) then
D.top ()
else
return ctx exp_opt f
let special ctx var_opt v exprs =
if is_multithreaded (ask_of_man ctx) then
D.top ()
else
special ctx var_opt v exprs
let enter ctx var_opt f args =
if is_multithreaded (ask_of_man ctx) then
[D.top (),D.top ()]
else
enter ctx var_opt f args
let combine_env ctx var_opt expr f exprs t_context_opt t (ask: Queries.ask) =
if is_multithreaded (ask_of_man ctx) then
D.top ()
else
combine_env ctx var_opt expr f exprs t_context_opt t ask
let combine_assign ctx var_opt expr f args t_context_opt t (ask: Queries.ask) =
if is_multithreaded (ask_of_man ctx) then
D.top ()
else
combine_assign ctx var_opt expr f args t_context_opt t ask
let threadenter ctx ~multiple lval f args =
[D.top ()]
let threadspawn ctx ~multiple lval f args fctx =
D.top ()
end