Skip to content

Commit f91c892

Browse files
committed
Fix autotune indentation (PR #772)
1 parent 75d638f commit f91c892

File tree

3 files changed

+24
-28
lines changed

3 files changed

+24
-28
lines changed

src/analyses/base.ml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,12 @@ struct
9999
let add_to_array_map fundec arguments =
100100
let rec pointedArrayMap = function
101101
| [] -> VarMap.empty
102-
| (info,value)::xs -> (
102+
| (info,value)::xs ->
103103
match value with
104-
| `Address t when hasAttribute "goblint_array_domain" info.vattr -> (
105-
let possibleVars = PreValueDomain.AD.to_var_may t in
106-
List.fold_left (fun map arr -> VarMap.add arr (info.vattr) map) (pointedArrayMap xs) @@ List.filter (fun info -> isArrayType info.vtype) possibleVars
107-
)
108-
| _ -> pointedArrayMap xs
109-
)
104+
| `Address t when hasAttribute "goblint_array_domain" info.vattr ->
105+
let possibleVars = PreValueDomain.AD.to_var_may t in
106+
List.fold_left (fun map arr -> VarMap.add arr (info.vattr) map) (pointedArrayMap xs) @@ List.filter (fun info -> isArrayType info.vtype) possibleVars
107+
| _ -> pointedArrayMap xs
110108
in
111109
match VarH.find_option array_map fundec.svar with
112110
| Some _ -> () (*We already have something -> do not change it*)
@@ -129,8 +127,7 @@ struct
129127
VD.project ask p a value
130128

131129
let project ask p_opt cpa fundec =
132-
CPA.mapi (fun varinfo value -> project_val ask (attributes_varinfo varinfo fundec) p_opt value (is_privglob varinfo))
133-
cpa
130+
CPA.mapi (fun varinfo value -> project_val ask (attributes_varinfo varinfo fundec) p_opt value (is_privglob varinfo)) cpa
134131

135132

136133
(**************************************************************************
@@ -2760,8 +2757,8 @@ struct
27602757
(* Projection to Precision of the Caller *)
27612758
let p = PrecisionUtil.int_precision_from_node ()in (* Since f is the fundec of the Callee we have to get the fundec of the current Node instead *)
27622759
let callerFundec = match !MyCFG.current_node with
2763-
| Some n -> Node.find_fundec n
2764-
| None -> failwith "callerfundec not found"
2760+
| Some n -> Node.find_fundec n
2761+
| None -> failwith "callerfundec not found"
27652762
in
27662763
let return_val = project_val (Analyses.ask_of_ctx ctx) (attributes_varinfo (return_varinfo ()) callerFundec) (Some p) return_val (is_privglob (return_varinfo ())) in
27672764
let cpa' = project (Analyses.ask_of_ctx ctx) (Some p) nst.cpa callerFundec in

src/autoTune.ml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,18 @@ let notNeccessaryThreadAnalyses = ["deadlock"; "maylocks"; "symb_locks"; "thread
139139
let reduceThreadAnalyses () =
140140
let hasThreadCreate () =
141141
ResettableLazy.force functionCallMaps
142-
|> fun (_,x,_) -> x (*every function that is called*)
143-
|> FunctionCallMap.exists
144-
(fun var (callers,_) ->
145-
let desc = LibraryFunctions.find var in
146-
match (functionArgs var) with
147-
| None -> false;
148-
| Some args ->
149-
match desc.special args with
150-
| ThreadCreate _ ->
151-
print_endline @@ "thread created by " ^ var.vname ^ ", called by:";
152-
FunctionSet.iter ( fun c -> print_endline @@ " " ^ c.vname) callers;
153-
true;
154-
| _ -> false;
142+
|> (fun (_,x,_) -> x) (*every function that is called*)
143+
|> FunctionCallMap.exists (fun var (callers,_) ->
144+
let desc = LibraryFunctions.find var in
145+
match functionArgs var with
146+
| None -> false;
147+
| Some args ->
148+
match desc.special args with
149+
| ThreadCreate _ ->
150+
print_endline @@ "thread created by " ^ var.vname ^ ", called by:";
151+
FunctionSet.iter ( fun c -> print_endline @@ " " ^ c.vname) callers;
152+
true
153+
| _ -> false
155154
)
156155
in
157156
if not @@ hasThreadCreate () then (

src/cdomains/apron/apronDomain.apron.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ module M = Messages
1616
- heterogeneous environments: https://link.springer.com/chapter/10.1007%2F978-3-030-17184-1_26 (Section 4.1) *)
1717

1818
let widening_thresholds_apron = ResettableLazy.from_fun (fun () ->
19-
let t = if GobConfig.get_string "ana.apron.threshold_widening_constants" = "comparisons" then WideningThresholds.octagon_thresholds () else WideningThresholds.thresholds_incl_mul2 () in
20-
let r = List.map (fun x -> Apron.Scalar.of_mpqf @@ Mpqf.of_mpz @@ Z_mlgmpidl.mpz_of_z x) t in
21-
Array.of_list r
22-
)
19+
let t = if GobConfig.get_string "ana.apron.threshold_widening_constants" = "comparisons" then WideningThresholds.octagon_thresholds () else WideningThresholds.thresholds_incl_mul2 () in
20+
let r = List.map (fun x -> Apron.Scalar.of_mpqf @@ Mpqf.of_mpz @@ Z_mlgmpidl.mpz_of_z x) t in
21+
Array.of_list r
22+
)
2323

2424
let reset_lazy () =
2525
ResettableLazy.reset widening_thresholds_apron

0 commit comments

Comments
 (0)