package mopsa
Install
Dune Dependency
Authors
Maintainers
Sources
md5=9f673f79708b44a7effb3b6bb3618d2c
sha512=cb91cb428e43a22f1abbcb8219710d0c10a5b3756d0da392d4084b3b3a6157350776c596983e63def344f617d39964e91f244f60c07958695ee5c8c809a9f0f4
doc/core/Core/Effect/index.html
Module Core.Effect
Source
Effects are a journal of all statements executed by the domains when computing a post-condition.
They are used to merge two post-conditions that diverged due to a fork-join trajectory in the abstraction DAG.
Effects
Fold over the statements in the effect
Effect trees
Effects are presented as binary trees. Each node of the tree is associated to a domain in the abstraction and stores the statements executed by the domain when computing a post-condition.
Note that this representation is also useful when we have an abstraction DAG (i.e. when there are shared domains) thanks to the compose (stack) operator:
A x B \___/ | C
is represented as:
o / \ x C / \ A B
mk_teffect effect left right
creates an effect tree with a root containing effect
and having left
and right
as the two sub-trees
get_right_teffect te
returns the right sub-tree of te
get_log_stmts te
returns the effect at the root node of te
get_left_teffect left te
sets left
as the left sub-tree of te
get_right_teffect right te
sets right
as the right sub-tree of te
map_left_teffect f te
is equivalent to set_left_teffect (f (get_left_teffect te)) te
map_right_teffect f te
is equivalent to set_right_teffect (f (get_right_teffect te)) te
add_stmt_to_teffect stmt teffect
adds stmt
to the the effects of the root no of te
val merge_teffect :
(effect -> effect) ->
(effect -> effect) ->
(effect -> effect -> effect) ->
teffect ->
teffect ->
teffect
merge_teffect f1 f2 f te1 te2
combines te1
and te2
concat_teffect old recent
puts effects in old
before those in recent
merge_teffect te1 te2
computes the effects of two intersected post-states
merge_teffect te1 te2
computes the effects of two joined post-states
Fold over the statements in the effects tree
Generic merge
Effect of a statement in terms of modified and removed variables
val generic_merge :
add:(Ast.Var.var -> 'b -> 'a -> 'a) ->
find:(Ast.Var.var -> 'a -> 'b) ->
remove:(Ast.Var.var -> 'a -> 'a) ->
?custom:(Ast.Stmt.stmt -> var_effect option) ->
('a * effect) ->
('a * effect) ->
'a * 'a
Generic merge operator. generic_merge ~add ~find ~remove ~custom (a1,e1) (a2,e2)
applies a generic merge of states a1
and a2
:
- It searches for modified variables in one state's effects, gets their value using
find
and adds them to the other state usingadd
. - It searches for removed variables in one state's effects and remove them from the other state using
remove
. This function handles common statements (assign,assume,add,remove,fold,expand and rename). Other statements can be handled using thecustom
function that returns thevar_effect
of a given statement.