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
8c44e216
Commit
8c44e216
authored
3 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[Slicing] Minor simplifications in the use of Eva results.
parent
e6c234b9
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/slicing/fct_slice.ml
+2
-5
2 additions, 5 deletions
src/plugins/slicing/fct_slice.ml
src/plugins/slicing/slicingCmds.ml
+9
-14
9 additions, 14 deletions
src/plugins/slicing/slicingCmds.ml
with
11 additions
and
19 deletions
src/plugins/slicing/fct_slice.ml
+
2
−
5
View file @
8c44e216
...
@@ -54,9 +54,7 @@ let exists_fun_callers fpred kf =
...
@@ -54,9 +54,7 @@ let exists_fun_callers fpred kf =
then
false
(* no way to call the initial [kf]. *)
then
false
(* no way to call the initial [kf]. *)
else
begin
else
begin
table
:=
Kernel_function
.
Set
.
add
kf
!
table
;
table
:=
Kernel_function
.
Set
.
add
kf
!
table
;
List
.
exists
List
.
exists
exists_fun_callers
(
Eva
.
Results
.
callers
kf
)
(
fun
kf
->
exists_fun_callers
kf
)
(
Eva
.
Results
.
callers
kf
)
end
end
in
in
exists_fun_callers
kf
exists_fun_callers
kf
...
@@ -1454,12 +1452,11 @@ let merge_fun_callers get_list get_value merge is_top acc kf =
...
@@ -1454,12 +1452,11 @@ let merge_fun_callers get_list get_value merge is_top acc kf =
raise
StopMerging
(* acceleration when top is reached *)
raise
StopMerging
(* acceleration when top is reached *)
in
in
let
rec
merge_fun_callers
kf
=
let
rec
merge_fun_callers
kf
=
let
merge_fun_caller
kf
=
merge_fun_callers
kf
in
let
vf
=
Kernel_function
.
get_vi
kf
in
let
vf
=
Kernel_function
.
get_vi
kf
in
if
not
(
Cil_datatype
.
Varinfo
.
Set
.
mem
vf
!
table
)
then
begin
if
not
(
Cil_datatype
.
Varinfo
.
Set
.
mem
vf
!
table
)
then
begin
table
:=
Cil_datatype
.
Varinfo
.
Set
.
add
vf
!
table
;
table
:=
Cil_datatype
.
Varinfo
.
Set
.
add
vf
!
table
;
List
.
iter
(
fun
x
->
merge
(
get_value
x
))
(
get_list
kf
)
;
List
.
iter
(
fun
x
->
merge
(
get_value
x
))
(
get_list
kf
)
;
List
.
iter
merge_fun_caller
(
Eva
.
Results
.
callers
kf
)
List
.
iter
merge_fun_caller
s
(
Eva
.
Results
.
callers
kf
)
end
end
(* else no way to add something, the [kf] contribution is already
(* else no way to add something, the [kf] contribution is already
accumulated. *)
accumulated. *)
...
...
This diff is collapsed.
Click to expand it.
src/plugins/slicing/slicingCmds.ml
+
9
−
14
View file @
8c44e216
...
@@ -55,6 +55,11 @@ let apply_all ~propagate_to_callers =
...
@@ -55,6 +55,11 @@ let apply_all ~propagate_to_callers =
let
get_select_kf
(
fvar
,
_select
)
=
Globals
.
Functions
.
get
fvar
let
get_select_kf
(
fvar
,
_select
)
=
Globals
.
Functions
.
get
fvar
let
get_lval_zone
?
(
access
=
Locations
.
Read
)
stmt
lval
=
let
open
Eva
.
Results
in
before
stmt
|>
eval_address
lval
|>
as_zone
~
access
|>
default
Locations
.
Zone
.
bottom
(** Utilities for [kinstr]. *)
(** Utilities for [kinstr]. *)
module
Kinstr
:
sig
module
Kinstr
:
sig
val
iter_from_func
:
(
stmt
->
unit
)
->
kernel_function
->
unit
val
iter_from_func
:
(
stmt
->
unit
)
->
kernel_function
->
unit
...
@@ -76,12 +81,8 @@ struct
...
@@ -76,12 +81,8 @@ struct
(* returns [read_zone] joined to [Zone.t read] by [lv], [Zone.t written] by [lv] *)
(* returns [read_zone] joined to [Zone.t read] by [lv], [Zone.t written] by [lv] *)
(* The modified locations are [looking_for], those address are
(* The modified locations are [looking_for], those address are
function of [deps]. *)
function of [deps]. *)
let
zloc
,
deps
=
let
zloc
=
get_lval_zone
~
access
:
Locations
.
Write
stmt
lv
in
Eva
.
Results
.(
let
deps
=
Eva
.
Results
.(
before
stmt
|>
address_deps
lv
)
in
before
stmt
|>
eval_address
lv
|>
as_zone
~
access
:
Locations
.
Write
|>
default
Locations
.
Zone
.
bottom
,
before
stmt
|>
address_deps
lv
)
in
Locations
.
Zone
.
join
read_zone
deps
,
zloc
Locations
.
Zone
.
join
read_zone
deps
,
zloc
in
in
let
call_process
lv
f
args
_loc
=
let
call_process
lv
f
args
_loc
=
...
@@ -320,10 +321,7 @@ let select_stmt_lval set mark lval_str ~before ki ~eval kf =
...
@@ -320,10 +321,7 @@ let select_stmt_lval set mark lval_str ~before ki ~eval kf =
let
lval
=
let
lval
=
!
Db
.
Properties
.
Interp
.
term_lval_to_lval
~
result
:
None
lval_term
!
Db
.
Properties
.
Interp
.
term_lval_to_lval
~
result
:
None
lval_term
in
in
let
zone
=
let
zone
=
get_lval_zone
eval
lval
in
Eva
.
Results
.(
before
eval
|>
eval_address
lval
|>
as_zone
)
|>
Result
.
value
~
default
:
Locations
.
Zone
.
bottom
in
Locations
.
Zone
.
join
zone
acc
)
Locations
.
Zone
.
join
zone
acc
)
lval_str
lval_str
Locations
.
Zone
.
bottom
Locations
.
Zone
.
bottom
...
@@ -353,10 +351,7 @@ let select_lval_rw set mark ~rd ~wr ~eval kf ki_opt=
...
@@ -353,10 +351,7 @@ let select_lval_rw set mark ~rd ~wr ~eval kf ki_opt=
let
lval_term
=
!
Db
.
Properties
.
Interp
.
term_lval
kf
lval_str
in
let
lval_term
=
!
Db
.
Properties
.
Interp
.
term_lval
kf
lval_str
in
let
lval
=
!
Db
.
Properties
.
Interp
.
term_lval_to_lval
~
result
:
None
lval_term
in
let
lval
=
!
Db
.
Properties
.
Interp
.
term_lval_to_lval
~
result
:
None
lval_term
in
let
access
=
if
for_writing
then
Locations
.
Write
else
Locations
.
Read
in
let
access
=
if
for_writing
then
Locations
.
Write
else
Locations
.
Read
in
let
zone
=
let
zone
=
get_lval_zone
~
access
eval
lval
in
Eva
.
Results
.(
before
eval
|>
eval_address
lval
|>
as_zone
~
access
)
|>
Result
.
value
~
default
:
Locations
.
Zone
.
bottom
in
Locations
.
Zone
.
join
zone
acc
)
Locations
.
Zone
.
join
zone
acc
)
lval_str
Locations
.
Zone
.
bottom
lval_str
Locations
.
Zone
.
bottom
in
SlicingParameters
.
debug
~
level
:
3
in
SlicingParameters
.
debug
~
level
:
3
...
...
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