You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ifnot (Param.handle_atomic && ask.f MustBeAtomic) then
926
962
sideg (V.unprotected x) v; (* Delay publishing unprotected write in the atomic section. *)
@@ -929,11 +965,11 @@ struct
929
965
(* Unlock after invariant will still side effect refined value (if protected) from CPA, because cannot distinguish from non-invariant write since W is implicit. *)
930
966
);
931
967
ifParam.handle_atomic && ask.f MustBeAtomicthen
932
-
{st with cpa =CPA.add x v st.cpa; priv =P.add x st.priv} (* Keep write local as if it were protected by the atomic section. *)
933
-
elseifis_unprotected ask xthen
968
+
{st with cpa =CPA.add x v st.cpa; priv =D.add invariant x v st.priv} (* Keep write local as if it were protected by the atomic section. *)
969
+
elseifunprotectedthen
934
970
st
935
971
else
936
-
{st with cpa =CPA.add x v st.cpa; priv =P.add x st.priv}
972
+
{st with cpa =CPA.add x v st.cpa; priv =D.add invariant x v st.priv}
937
973
938
974
letlockaskgetgstm= st
939
975
@@ -943,16 +979,22 @@ struct
943
979
(* TODO: what about G_m globals in cpa that weren't actually written? *)
944
980
CPA.fold (funxv (st: BaseComponents (D).t) ->
945
981
if is_protected_by ask m x then ( (* is_in_Gm *)
946
-
(* Extra precision in implementation to pass tests:
947
-
If global is read-protected by multiple locks,
948
-
then inner unlock shouldn't yet publish. *)
949
-
ifnotParam.check_read_unprotected || is_unprotected_without ask ~write:false x m then
950
-
sideg (V.protected x) v;
951
-
if atomic then
952
-
sideg (V.unprotected x) v; (* Publish delayed unprotected write as if it were protected by the atomic section. *)
953
-
982
+
(* Only apply sides for values that were actually written to globals!
983
+
This excludes invariants inferred through guards. *)
984
+
beginmatchD.precise_side x v st.priv with
985
+
|Somev -> begin
986
+
(* Extra precision in implementation to pass tests:
987
+
If global is read-protected by multiple locks,
988
+
then inner unlock shouldn't yet publish. *)
989
+
ifnotParam.check_read_unprotected || is_unprotected_without ask ~write:false x m then
990
+
sideg (V.protected x) v;
991
+
if atomic then
992
+
sideg (V.unprotected x) v; (* Publish delayed unprotected write as if it were protected by the atomic section. *)
993
+
end
994
+
|None -> ()
995
+
end;
954
996
if is_unprotected_without ask x m then(* is_in_V' *)
955
-
{st with cpa =CPA.remove x st.cpa; priv =P.remove x st.priv}
997
+
{st with cpa =CPA.remove x st.cpa; priv =D.remove x st.priv}
956
998
else
957
999
st
958
1000
)
@@ -968,7 +1010,7 @@ struct
968
1010
if is_global ask x && is_unprotected ask x then (
969
1011
sideg (V.unprotected x) v;
970
1012
sideg (V.protected x) v; (* must be like enter_multithreaded *)
971
-
{st with cpa =CPA.remove x st.cpa; priv =P.remove x st.priv}
1013
+
{st with cpa =CPA.remove x st.cpa; priv =D.remove x st.priv}
972
1014
)
973
1015
else
974
1016
st
@@ -1007,7 +1049,7 @@ struct
1007
1049
if is_global ask x then (
1008
1050
sideg (V.unprotected x) v;
1009
1051
sideg (V.protected x) v;
1010
-
{st with cpa =CPA.remove x st.cpa; priv =P.remove x st.priv}
1052
+
{st with cpa =CPA.remove x st.cpa; priv =D.remove x st.priv}
1011
1053
)
1012
1054
else
1013
1055
st
@@ -2116,19 +2158,21 @@ end
2116
2158
2117
2159
let priv_module: (moduleS) Lazy.t =
2118
2160
lazy (
2161
+
let changes_only = get_bool "ana.base.priv.protection.changes-only"in
2162
+
letmodule ProtDom: ProtectionDom = (val if changes_only then (moduleProtectionChangesOnlySide : ProtectionDom) else (moduleProtectionCPASide)) in
2119
2163
letmodule Priv: S =
2120
2164
(val match get_string "ana.base.privatization"with
"description": "Controls when to widen divided sides. true: Only widen on a side-effect, if joining would affect the overall value of the global. false: Always widen increasing/incomparable side-effects",
"description": "Controls when growing side-effects are applied. true: immediately when they are triggered. false: after the source unknown has been fully evaluated",
2562
+
"type": "boolean",
2563
+
"default": true
2564
+
},
2565
+
"narrow-gas": {
2566
+
"title": "solvers.td3.narrow-globs.narrow-gas",
2567
+
"description": "Limits the number of times a side-effect can switch from widening to narrowing to enforce termination. 0 disables narrowing, -1 allows narrowing infinitely often.",
Copy file name to clipboardExpand all lines: src/constraint/constrSys.ml
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -46,8 +46,12 @@ sig
46
46
(** The system in functional form. *)
47
47
valsystem : v -> ((v -> d) -> (v -> d -> unit) -> d) m
48
48
49
-
valsys_change: (v -> d) -> vsys_change_info
50
49
(** Compute incremental constraint system change from old solution. *)
50
+
valsys_change: (v -> d) -> vsys_change_info
51
+
52
+
(** List of unknowns that should be queried again when the argument unknown has shrunk to bot, to eagerly trigger (analysis-time!) abstract garbage collection idependently of reach-based pruning at the end.
53
+
@see <https://arxiv.org/abs/2504.06026> Stemmler, F., Schwarz, M., Erhard, J., Tilscher, S., Seidl, H. Taking out the Toxic Trash: Recovering Precision in Mixed Flow-Sensitive Static Analyses *)
54
+
valpostmortem: v -> vlist
51
55
end
52
56
53
57
(** Any system of side-effecting equations over lattices. *)
Copy file name to clipboardExpand all lines: src/maingoblint.ml
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,8 @@ let check_arguments () =
141
141
if get_bool "ana.base.context.int"&¬ (get_bool "ana.base.context.non-ptr") then (set_bool "ana.base.context.int"false; warn "ana.base.context.int implicitly disabled by ana.base.context.non-ptr");
142
142
(* order matters: non-ptr=false, int=true -> int=false cascades to interval=false with warning *)
143
143
if get_bool "ana.base.context.interval"&¬ (get_bool "ana.base.context.int") then (set_bool "ana.base.context.interval"false; warn "ana.base.context.interval implicitly disabled by ana.base.context.int");
144
+
if get_bool "ana.base.priv.protection.changes-only"&¬@@List.mem (get_string "ana.base.privatization") ["protection"; "protection-tid"; "protection-atomic"; "protection-read"; "protection-read-tid"; "protection-read-atomic"] then
145
+
warn "ana.base.priv.protection.changes-only requires ana.base.privatization to be protection based";
144
146
if get_bool "incremental.only-rename"then (set_bool "incremental.load"true; warn "incremental.only-rename implicitly activates incremental.load. Previous AST is loaded for diff and rename, but analyis results are not reused.");
145
147
if get_bool "incremental.restart.sided.enabled"&& get_string_list "incremental.restart.list"<>[]then warn "Passing a non-empty list to incremental.restart.list (manual restarting) while incremental.restart.sided.enabled (automatic restarting) is activated.";
146
148
if get_bool "ana.autotune.enabled"&& get_bool "incremental.load"then (set_bool "ana.autotune.enabled"false; warn "ana.autotune.enabled implicitly disabled by incremental.load");
@@ -164,6 +166,10 @@ let check_arguments () =
164
166
);
165
167
if get_bool "solvers.td3.space"&& get_bool "solvers.td3.remove-wpoint"then fail "solvers.td3.space is incompatible with solvers.td3.remove-wpoint";
166
168
if get_bool "solvers.td3.space"&& get_string "solvers.td3.side_widen"="sides-local"then fail "solvers.td3.space is incompatible with solvers.td3.side_widen = 'sides-local'";
169
+
if get_bool "solvers.td3.space"&& get_bool "solvers.td3.narrow-globs.enabled"then fail "solvers.td3.space is incompatible with solvers.td3.narrow-globs.enabled";
170
+
if (get_bool "incremental.load"|| get_bool "incremental.save") && get_bool "solvers.td3.narrow-globs.enabled"then (
171
+
fail "solvers.td3.space is incompatible with incremental analsyis.";
ifGobConfig.get_bool "incremental.load"||GobConfig.get_bool "incremental.save"then fail "termination analysis is not compatible with incremental analysis";
0 commit comments