Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
bbe369d8
Commit
bbe369d8
authored
4 years ago
by
Allan Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
[wp] Move some functions in CfgCalculus
parent
159e2efc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/wp/cfgCalculus.ml
+50
-41
50 additions, 41 deletions
src/plugins/wp/cfgCalculus.ml
with
50 additions
and
41 deletions
src/plugins/wp/cfgCalculus.ml
+
50
−
41
View file @
bbe369d8
...
...
@@ -347,6 +347,40 @@ struct
if
not
(
is_default_bhv
mode
)
then
[]
else
CfgAnnot
.
get_disjoint_behaviors
kf
let
do_preconditions
env
~
main
~
behaviors
~
requires
~
def_requires
~
assumes
w
=
let
prove_if_main
ps
w
=
if
main
then
List
.
fold_right
(
prove_property
env
)
ps
w
else
w
in
List
.
fold_right
(
use_property
env
)
def_requires
@@
List
.
fold_right
(
use_property
env
)
assumes
@@
prove_if_main
requires
@@
List
.
fold_right
(
use_property
env
)
requires
@@
List
.
fold_right
(
use_property
env
)
behaviors
w
let
do_complete_disjoint
env
~
complete
~
disjoint
w
=
List
.
fold_right
(
prove_property
env
)
complete
@@
List
.
fold_right
(
prove_property
env
)
disjoint
w
let
do_function_body
env
w
=
Vhash
.
add
env
.
wp
env
.
cfg
.
return_point
(
Some
w
)
;
wp
env
env
.
cfg
.
entry_point
let
do_post_exit
env
has_exit
xs
~
post
~
post_assigns
~
exit
~
exit_assigns
w
=
let
w_exit
=
W
.
scope
env
.
we
xs
SC_Frame_out
@@
W
.
label
env
.
we
None
Clabels
.
at_exit
@@
List
.
fold_right
(
prove_property
env
)
exit
@@
if
has_exit
then
prove_assigns
env
exit_assigns
w
else
w
in
let
w_post
=
W
.
scope
env
.
we
xs
SC_Frame_out
@@
W
.
label
env
.
we
None
Clabels
.
post
@@
List
.
fold_right
(
prove_property
env
)
post
@@
prove_assigns
env
post_assigns
w
in
env
.
wk
<-
w_exit
;
w_post
(* Putting everything together *)
let
compute
~
mode
~
props
=
let
kf
=
mode
.
kf
in
...
...
@@ -360,44 +394,19 @@ struct
wk
=
W
.
empty
;
}
in
let
xs
=
Kernel_function
.
get_formals
kf
in
let
req
=
default_requires
mode
kf
in
let
bhv
=
CfgAnnot
.
get_behavior
kf
Kglobal
has_exit
~
active
:
[]
mode
.
bhv
in
let
prove_if_main
env
ps
=
if
not
@@
WpStrategy
.
is_main_init
kf
then
Extlib
.
id
else
List
.
fold_right
(
prove_property
env
)
ps
in
let
do_preconditions
env
w
=
List
.
fold_right
(
use_property
env
)
req
@@
List
.
fold_right
(
use_property
env
)
bhv
.
bhv_assumes
@@
prove_if_main
env
bhv
.
bhv_requires
@@
List
.
fold_right
(
use_property
env
)
bhv
.
bhv_requires
@@
List
.
fold_right
(
use_property
env
)
(
behaviors
kf
)
w
in
let
do_complete_disjoint
env
w
=
List
.
fold_right
(
prove_property
env
)
(
complete
mode
kf
)
@@
List
.
fold_right
(
prove_property
env
)
(
disjoint
mode
kf
)
w
in
let
do_function_body
env
w
=
Vhash
.
add
env
.
wp
env
.
cfg
.
return_point
(
Some
w
)
;
wp
env
env
.
cfg
.
entry_point
in
let
do_post_exit
env
w
=
let
w_exit
=
W
.
scope
env
.
we
xs
SC_Frame_out
@@
W
.
label
env
.
we
None
Clabels
.
at_exit
@@
List
.
fold_right
(
prove_property
env
)
bhv
.
bhv_exits
@@
if
not
has_exit
then
w
else
prove_assigns
env
bhv
.
bhv_exit_assigns
w
in
let
w_post
=
W
.
scope
env
.
we
xs
SC_Frame_out
@@
W
.
label
env
.
we
None
Clabels
.
post
@@
List
.
fold_right
(
prove_property
env
)
bhv
.
bhv_ensures
@@
prove_assigns
env
bhv
.
bhv_post_assigns
w
in
env
.
wk
<-
w_exit
;
w_post
in
let
bhvs
=
CfgAnnot
.
get_behavior
kf
Kglobal
has_exit
~
active
:
[]
mode
.
bhv
in
let
def_requires
=
default_requires
mode
kf
in
let
requires
=
bhvs
.
bhv_requires
in
let
assumes
=
bhvs
.
bhv_assumes
in
let
post
=
bhvs
.
bhv_ensures
in
let
post_assigns
=
bhvs
.
bhv_post_assigns
in
let
exit
=
bhvs
.
bhv_exits
in
let
exit_assigns
=
bhvs
.
bhv_exit_assigns
in
let
main
=
WpStrategy
.
is_main_init
kf
in
let
behaviors
=
behaviors
kf
in
let
complete
=
complete
mode
kf
in
let
disjoint
=
disjoint
mode
kf
in
env
.
we
,
(* global init *)
...
...
@@ -410,13 +419,13 @@ struct
(* frame-in *)
W
.
scope
env
.
we
xs
SC_Frame_in
@@
do_preconditions
env
@@
do_complete_disjoint
env
@@
do_preconditions
env
~
main
~
behaviors
~
requires
~
def_requires
~
assumes
@@
do_complete_disjoint
env
~
complete
~
disjoint
@@
do_function_body
env
@@
(* NOTE: do_post_exit performs frame-out on both post and exit *)
(* Post-conds*)
do_post_exit
env
@@
do_post_exit
env
has_exit
xs
~
post
~
post_assigns
~
exit
~
exit_assigns
@@
(* wp-end *)
W
.
empty
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment