@@ -20,19 +20,20 @@ struct
2020 include StdV
2121 end
2222
23- let regions exp part st : Lval.CilLval.t list =
24- match st with
23+ let regions ctx exp part : Lval.CilLval.t list =
24+ match ctx.local with
2525 | `Lifted reg ->
26- let ev = Reg. eval_exp exp in
26+ let ask = Analyses. ask_of_ctx ctx in
27+ let ev = Reg. eval_exp ask exp in
2728 let to_exp (v ,f ) = (v,Lval.Fields. to_offs' f) in
28- List. map to_exp (Reg. related_globals ev (part,reg))
29+ List. map to_exp (Reg. related_globals ask ev (part,reg))
2930 | `Top -> Messages. info ~category: Unsound " Region state is broken :(" ; []
3031 | `Bot -> []
3132
32- let is_bullet exp part st : bool =
33- match st with
33+ let is_bullet ctx exp part : bool =
34+ match ctx.local with
3435 | `Lifted reg ->
35- begin match Reg. eval_exp exp with
36+ begin match Reg. eval_exp ( Analyses. ask_of_ctx ctx) exp with
3637 | Some (_ ,v ,_ ) -> (try RegionDomain.RS. is_single_bullet (RegMap. find v reg) with Not_found -> false )
3738 | _ -> false
3839 end
@@ -41,18 +42,18 @@ struct
4142
4243 let get_region ctx e =
4344 let regpart = ctx.global () in
44- if is_bullet e regpart ctx.local then
45+ if is_bullet ctx e regpart then
4546 None
4647 else
47- Some (regions e regpart ctx.local )
48+ Some (regions ctx e regpart)
4849
4950 (* queries *)
5051 let query ctx (type a ) (q : a Queries.t ): a Queries.result =
5152 match q with
5253 | Queries. Regions e ->
5354 let regpart = ctx.global () in
54- if is_bullet e regpart ctx.local then Queries.Result. bot q (* TODO: remove bot *) else
55- let ls = List. fold_right Queries.LS. add (regions e regpart ctx.local ) (Queries.LS. empty () ) in
55+ if is_bullet ctx e regpart then Queries.Result. bot q (* TODO: remove bot *) else
56+ let ls = List. fold_right Queries.LS. add (regions ctx e regpart) (Queries.LS. empty () ) in
5657 ls
5758 | _ -> Queries.Result. top q
5859
9394 match ctx.local with
9495 | `Lifted reg ->
9596 let old_regpart = ctx.global () in
96- let regpart, reg = Reg. assign lval rval (old_regpart, reg) in
97+ let regpart, reg = Reg. assign ( Analyses. ask_of_ctx ctx) lval rval (old_regpart, reg) in
9798 if not (RegPart. leq regpart old_regpart) then
9899 ctx.sideg () regpart;
99100 `Lifted reg
@@ -113,7 +114,7 @@ struct
113114 let regpart, reg = match exp with
114115 | Some exp ->
115116 let module BS = (val Base. get_main () ) in
116- Reg. assign (BS. return_lval () ) exp (old_regpart, reg)
117+ Reg. assign (Analyses. ask_of_ctx ctx) ( BS. return_lval () ) exp (old_regpart, reg)
117118 | None -> (old_regpart, reg)
118119 in
119120 let regpart, reg = Reg. kill_vars locals (Reg. remove_vars locals (regpart, reg)) in
@@ -131,7 +132,7 @@ struct
131132 in
132133 match ctx.local with
133134 | `Lifted reg ->
134- let f x r reg = Reg. assign (var x) r reg in
135+ let f x r reg = Reg. assign (Analyses. ask_of_ctx ctx) ( var x) r reg in
135136 let old_regpart = ctx.global () in
136137 let regpart, reg = fold_right2 f fundec.sformals args (old_regpart,reg) in
137138 if not (RegPart. leq regpart old_regpart) then
@@ -146,7 +147,7 @@ struct
146147 let module BS = (val Base. get_main () ) in
147148 let regpart, reg = match lval with
148149 | None -> (old_regpart, reg)
149- | Some lval -> Reg. assign lval (AddrOf (BS. return_lval () )) (old_regpart, reg)
150+ | Some lval -> Reg. assign ( Analyses. ask_of_ctx ctx) lval (AddrOf (BS. return_lval () )) (old_regpart, reg)
150151 in
151152 let regpart, reg = Reg. remove_vars [BS. return_varinfo () ] (regpart, reg) in
152153 if not (RegPart. leq regpart old_regpart) then
@@ -163,7 +164,7 @@ struct
163164 | `Lifted reg , Some lv ->
164165 let old_regpart = ctx.global () in
165166 (* TODO: should realloc use arg region if failed/in-place? *)
166- let regpart, reg = Reg. assign_bullet lv (old_regpart, reg) in
167+ let regpart, reg = Reg. assign_bullet ( Analyses. ask_of_ctx ctx) lv (old_regpart, reg) in
167168 if not (RegPart. leq regpart old_regpart) then
168169 ctx.sideg () regpart;
169170 `Lifted reg
@@ -186,7 +187,7 @@ struct
186187 let fd = Cilfacade. find_varinfo_fundec f in
187188 match args, fd.sformals with
188189 | [exp], [param] ->
189- let reg = Reg. assign (var param) exp (ctx.global () , RegMap. bot () ) in
190+ let reg = Reg. assign (Analyses. ask_of_ctx ctx) ( var param) exp (ctx.global () , RegMap. bot () ) in
190191 [`Lifted (snd reg)]
191192 | _ -> [`Lifted (RegMap. bot () )]
192193 let threadspawn ctx lval f args fctx = ctx.local
0 commit comments