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
0 commit comments