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
cbe1c519
Commit
cbe1c519
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[wp] optimise passive form
parent
8a2d366c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/wp/Sigma.ml
+10
-9
10 additions, 9 deletions
src/plugins/wp/Sigma.ml
src/plugins/wp/cfgWP.ml
+13
-9
13 additions, 9 deletions
src/plugins/wp/cfgWP.ml
with
23 additions
and
18 deletions
src/plugins/wp/Sigma.ml
+
10
−
9
View file @
cbe1c519
...
...
@@ -115,15 +115,16 @@ struct
let
mem
w
c
=
H
.
Map
.
mem
c
w
.
map
let
join
a
b
=
let
p
=
ref
Passive
.
empty
in
H
.
Map
.
iter2
(
fun
chunk
x
y
->
match
x
,
y
with
|
Some
x
,
Some
y
->
p
:=
Passive
.
join
x
y
!
p
|
Some
x
,
None
->
b
.
map
<-
H
.
Map
.
add
chunk
x
b
.
map
|
None
,
Some
y
->
a
.
map
<-
H
.
Map
.
add
chunk
y
a
.
map
|
None
,
None
->
()
)
a
.
map
b
.
map
;
!
p
if
a
==
b
then
Passive
.
empty
else
let
p
=
ref
Passive
.
empty
in
H
.
Map
.
iter2
(
fun
chunk
x
y
->
match
x
,
y
with
|
Some
x
,
Some
y
->
p
:=
Passive
.
join
x
y
!
p
|
Some
x
,
None
->
b
.
map
<-
H
.
Map
.
add
chunk
x
b
.
map
|
None
,
Some
y
->
a
.
map
<-
H
.
Map
.
add
chunk
y
a
.
map
|
None
,
None
->
()
)
a
.
map
b
.
map
;
!
p
let
assigned
~
pre
~
post
written
=
let
p
=
ref
Bag
.
empty
in
...
...
This diff is collapsed.
Click to expand it.
src/plugins/wp/cfgWP.ml
+
13
−
9
View file @
cbe1c519
...
...
@@ -253,10 +253,6 @@ struct
(
fun
vc
(
warn
,
hyp
)
->
assume_vc
?
descr
?
filter
?
init
~
warn
[
hyp
]
vc
)
vc
whs
let
passify_vc
pa
vc
=
let
hs
=
Passive
.
conditions
pa
(
occurs_vc
vc
)
in
assume_vc
hs
vc
(* -------------------------------------------------------------------------- *)
(* --- Branching --- *)
(* -------------------------------------------------------------------------- *)
...
...
@@ -365,6 +361,14 @@ struct
(
fun
g
->
Splitter
.
merge_all
merge_vcs
(
List
.
map
(
goal
g
)
cases
))
targets
let
passify_vc
pa
vc
=
let
hs
=
Passive
.
conditions
pa
(
occurs_vc
vc
)
in
assume_vc
hs
vc
let
passify_vcs
pa
vcs
=
if
Passive
.
is_empty
pa
then
vcs
else
gmap
(
passify_vc
pa
)
vcs
(* -------------------------------------------------------------------------- *)
(* --- Merge for Calculus --- *)
(* -------------------------------------------------------------------------- *)
...
...
@@ -386,8 +390,8 @@ struct
(
fun
()
->
let
sigma
,
pa1
,
pa2
=
merge_sigma
wp1
.
sigma
wp2
.
sigma
in
let
effects
=
Eset
.
union
wp1
.
effects
wp2
.
effects
in
let
vcs1
=
gmap
(
passify_vc
pa1
)
wp1
.
vcs
in
let
vcs2
=
gmap
(
passify_vc
pa2
)
wp2
.
vcs
in
let
vcs1
=
passify_vc
s
pa1
wp1
.
vcs
in
let
vcs2
=
passify_vc
s
pa2
wp2
.
vcs
in
let
vcs
=
gmerge
vcs1
vcs2
in
{
sigma
=
sigma
;
vcs
=
vcs
;
effects
=
effects
}
)
()
...
...
@@ -659,7 +663,7 @@ struct
let
pa
=
Sigma
.
join
s_here
s_labl
in
let
stop
,
effects
=
Eset
.
partition
(
is_stopeffect
label
)
wp
.
effects
in
let
vcs
=
Gmap
.
filter
(
not_posteffect
stop
)
wp
.
vcs
in
let
vcs
=
gmap
(
passify_vc
pa
)
vcs
in
let
vcs
=
passify_vc
s
pa
vcs
in
let
vcs
=
check_nothing
stop
vcs
in
let
vcs
=
state_vcs
stmt
s_here
vcs
in
{
sigma
=
Some
s_here
;
vcs
=
vcs
;
effects
=
effects
})
...
...
@@ -809,8 +813,8 @@ struct
Some
(
Splitter
.
union
(
merge_vc
)
s1
s2
)
)
vcs1
vcs2
else
let
vcs1
=
gmap
(
passify_vc
pa1
)
wp1
.
vcs
in
let
vcs2
=
gmap
(
passify_vc
pa2
)
wp2
.
vcs
in
let
vcs1
=
passify_vc
s
pa1
wp1
.
vcs
in
let
vcs2
=
passify_vc
s
pa2
wp2
.
vcs
in
gbranch
~
left
:
(
assume_vc
~
descr
:
"Then"
~
stmt
~
warn
[
cond
])
~
right
:
(
assume_vc
~
descr
:
"Else"
~
stmt
~
warn
[
p_not
cond
])
...
...
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