Skip to content
Snippets Groups Projects
Commit 5a4e4fd1 authored by David Bühler's avatar David Bühler
Browse files

[Eva] Improves the use of memexec in the octagon domain.

parent 7ed2664e
No related branches found
No related tags found
No related merge requests found
...@@ -1015,7 +1015,7 @@ module State = struct ...@@ -1015,7 +1015,7 @@ module State = struct
with Not_found -> `Value state with Not_found -> `Value state
let add_octagon state octagon = let add_octagon state octagon =
if is_redundant state.intervals octagon if Ival.(equal top octagon.value) || is_redundant state.intervals octagon
then `Value state then `Value state
else else
let state = let state =
...@@ -1036,6 +1036,11 @@ module State = struct ...@@ -1036,6 +1036,11 @@ module State = struct
let relations = Relations.relate octagon.variables state.relations in let relations = Relations.relate octagon.variables state.relations in
{ state with octagons; relations } { state with octagons; relations }
let add_diamond state variables diamond =
add_octagon state { variables; operation = Add; value = diamond.add }
>>- fun state ->
add_octagon state { variables; operation = Sub; value = diamond.sub }
let remove state x = let remove state x =
let intervals = Intervals.remove x state.intervals in let intervals = Intervals.remove x state.intervals in
let state = { state with intervals } in let state = { state with intervals } in
...@@ -1381,7 +1386,7 @@ module Domain = struct ...@@ -1381,7 +1386,7 @@ module Domain = struct
let relations = Relations.filter mem_var state.relations in let relations = Relations.filter mem_var state.relations in
{ state with octagons; intervals; relations; } { state with octagons; intervals; relations; }
let reuse = let interprocedural_reuse =
let cache = Hptmap_sig.PersistentCache "Octagons.reuse" let cache = Hptmap_sig.PersistentCache "Octagons.reuse"
and symmetric = false and symmetric = false
and idempotent = true and idempotent = true
...@@ -1389,17 +1394,38 @@ module Domain = struct ...@@ -1389,17 +1394,38 @@ module Domain = struct
let join_oct = Octagons.internal_join ~cache ~symmetric ~idempotent ~decide let join_oct = Octagons.internal_join ~cache ~symmetric ~idempotent ~decide
and join_itv = Intervals.internal_join ~cache ~symmetric ~idempotent ~decide and join_itv = Intervals.internal_join ~cache ~symmetric ~idempotent ~decide
and join_rel = Relations.union in and join_rel = Relations.union in
fun _kf _bases ~current_input ~previous_output -> fun ~current_input ~previous_output ->
if intraprocedural () let current_input = kill previous_output.modified current_input in
then previous_output (* We use [add_diamond] to add each relation from the previous output
into the current input, in order to benefit from the (partial)
saturation of octagons performed by this function. For a maximum
precision, a complete saturation would be required.
Otherwise, we use instead a more efficient (but less precise) merge
of the maps from the previous output and the current input. *)
if saturate_octagons
then
let intervals =
join_itv previous_output.intervals current_input.intervals
in
let state = { current_input with intervals } in
let add_diamond variables diamond acc =
Bottom.non_bottom (add_diamond acc variables diamond)
in
Octagons.fold add_diamond previous_output.octagons state
else else
let current_input = kill previous_output.modified current_input in { octagons = join_oct previous_output.octagons current_input.octagons;
let prev_output = previous_output in intervals = join_itv previous_output.intervals current_input.intervals;
check "reuse result" relations = join_rel previous_output.relations current_input.relations;
{ octagons = join_oct prev_output.octagons current_input.octagons; modified = current_input.modified }
intervals = join_itv prev_output.intervals current_input.intervals;
relations = join_rel prev_output.relations current_input.relations; let reuse _kf _bases ~current_input ~previous_output =
modified = current_input.modified } if intraprocedural ()
then previous_output
else
let t = interprocedural_reuse ~current_input ~previous_output in
check "reuse result" t
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment