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
0a4c1fb4
Commit
0a4c1fb4
authored
6 years ago
by
Bouillaguet Quentin
Browse files
Options
Downloads
Patches
Plain Diff
[Wp/StmtSem] Use MM binder in StmtCompiler
parent
f8468845
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/wp/StmtSemantics.ml
+35
-15
35 additions, 15 deletions
src/plugins/wp/StmtSemantics.ml
with
35 additions
and
15 deletions
src/plugins/wp/StmtSemantics.ml
+
35
−
15
View file @
0a4c1fb4
...
@@ -66,6 +66,7 @@ struct
...
@@ -66,6 +66,7 @@ struct
(* --- Env Utilities --- *)
(* --- Env Utilities --- *)
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
let
result
env
=
env
.
result
let
result
env
=
env
.
result
let
bind
l
n
env
=
let
bind
l
n
env
=
...
@@ -575,6 +576,8 @@ struct
...
@@ -575,6 +576,8 @@ struct
let
automaton
:
env
->
Interpreted_automata
.
automaton
->
paths
=
fun
env
a
->
let
automaton
:
env
->
Interpreted_automata
.
automaton
->
paths
=
fun
env
a
->
let
open
Interpreted_automata
in
let
open
Interpreted_automata
in
let
binder
=
M
.
configure_ia
a
in
let
bind
=
binder
.
bind
in
let
wto
=
WTO
.
partition
~
pref
~
init
:
a
.
entry_point
~
succs
:
(
G
.
succ
a
.
graph
)
in
let
wto
=
WTO
.
partition
~
pref
~
init
:
a
.
entry_point
~
succs
:
(
G
.
succ
a
.
graph
)
in
let
index
=
Compute
.
build_wto_index_table
wto
in
let
index
=
Compute
.
build_wto_index_table
wto
in
...
@@ -620,8 +623,9 @@ struct
...
@@ -620,8 +623,9 @@ struct
do_list
~
fresh_nodes
paths
nodes
n2
l
do_list
~
fresh_nodes
paths
nodes
n2
l
in
in
let
rec
component
nodes
paths
=
function
let
rec
component
nodes
paths
=
function
|
Wto
.
Node
v
->
do_node
nodes
v
paths
|
Wto
.
Node
((
n
,
_
)
as
v
)
->
bind
n
(
do_node
nodes
v
)
paths
|
Wto
.
Component
(
v
,
l
)
->
|
Wto
.
Component
((
n
,
_
)
as
v
,
l
)
->
let
do_component
(
v
,
l
)
=
assert
(
not
(
Automata
.
Map
.
mem
v
nodes
.
local
));
assert
(
not
(
Automata
.
Map
.
mem
v
nodes
.
local
));
let
invariants
,
l
=
get_invariants
g
v
l
in
let
invariants
,
l
=
get_invariants
g
v
l
in
let
n
=
get_node
{
nodes
with
local
=
Automata
.
Map
.
empty
}
v
in
let
n
=
get_node
{
nodes
with
local
=
Automata
.
Map
.
empty
}
v
in
...
@@ -640,6 +644,9 @@ struct
...
@@ -640,6 +644,9 @@ struct
do_list
~
fresh_nodes
:
false
paths
(
add_local
nodes
v
n_havoc
)
do_list
~
fresh_nodes
:
false
paths
(
add_local
nodes
v
n_havoc
)
n_havoc
invariants_as_assumes
in
n_havoc
invariants_as_assumes
in
partition
(
add_local
nodes
v
n_loop
)
paths
l
partition
(
add_local
nodes
v
n_loop
)
paths
l
in
bind
n
do_component
(
v
,
l
)
and
partition
nodes
paths
l
=
and
partition
nodes
paths
l
=
List
.
fold_left
(
component
nodes
)
paths
l
List
.
fold_left
(
component
nodes
)
paths
l
in
in
...
@@ -744,21 +751,34 @@ struct
...
@@ -744,21 +751,34 @@ struct
let
compute_kf
kf
=
let
compute_kf
kf
=
let
autom
=
Interpreted_automata
.
Compute
.
get_automaton
~
annotations
:
true
kf
in
let
open
Interpreted_automata
in
let
autom
=
Compute
.
get_automaton
~
annotations
:
true
kf
in
(* let cout = open_out (Format.sprintf "/tmp/cfg_automata_%s.dot" (Kernel_function.get_name kf)) in
(* let cout = open_out (Format.sprintf "/tmp/cfg_automata_%s.dot" (Kernel_function.get_name kf)) in
* Interpreted_automata.Compute.output_to_dot cout autom;
* Interpreted_automata.Compute.output_to_dot cout autom;
* close_out cout; *)
* close_out cout; *)
let
nprepre
=
Cfg
.
node
()
in
let
binder
=
M
.
configure_ia
autom
in
let
npre
=
Cfg
.
node
()
in
let
bind
=
binder
.
bind
in
let
npost
=
Cfg
.
node
()
in
let
spec
=
Annotations
.
funspec
kf
in
let
npostpost
=
Cfg
.
node
()
in
(* start and end nodes of pre(resp. post)-conditions. *)
let
env
=
empty_env
kf
in
let
pres
=
{
pre
=
Cfg
.
node
()
;
post
=
Cfg
.
node
()
}
in
let
env
=
env
@*
[
Clabels
.
pre
,
npre
;
Clabels
.
post
,
npost
]
in
let
posts
=
{
pre
=
Cfg
.
node
()
;
post
=
Cfg
.
node
()
}
in
let
env
=
empty_env
kf
@*
[
Clabels
.
pre
,
pres
.
post
;
Clabels
.
post
,
posts
.
pre
]
in
(* initialization *)
let
init
=
init
~
is_pre_main
:
(
WpStrategy
.
is_main_init
kf
)
let
init
=
init
~
is_pre_main
:
(
WpStrategy
.
is_main_init
kf
)
(
env
@*
[
Clabels
.
here
,
nprepre
])
in
(
env
@*
[
Clabels
.
here
,
pres
.
pre
])
in
let
kf_spec
=
Annotations
.
funspec
kf
in
(* pre-condition *)
let
pre
=
pre_spec
(
env
@*
[
Clabels
.
here
,
nprepre
;
Clabels
.
next
,
npre
])
kf_spec
in
let
pre
=
let
paths
=
automaton
(
env
@*
[
Clabels
.
here
,
npre
;
Clabels
.
next
,
npost
])
autom
in
bind
autom
.
entry_point
@@
let
post
=
post_normal_spec
(
env
@*
[
Clabels
.
here
,
npost
;
Clabels
.
next
,
npostpost
])
kf_spec
in
pre_spec
(
env
@*
[
Clabels
.
here
,
pres
.
pre
;
Clabels
.
next
,
pres
.
post
])
init
@^
pre
@^
paths
@^
post
,
env
@:
Clabels
.
init
in
(* code *)
let
paths
=
automaton
(
env
@*
[
Clabels
.
here
,
pres
.
post
;
Clabels
.
next
,
posts
.
pre
])
autom
in
(* post-condition *)
let
post
=
bind
autom
.
return_point
@@
post_normal_spec
(
env
@*
[
Clabels
.
here
,
posts
.
pre
;
Clabels
.
next
,
posts
.
post
])
in
init
@^
pre
spec
@^
paths
@^
post
spec
,
env
@:
Clabels
.
init
end
end
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