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
79299124
Commit
79299124
authored
8 years ago
by
Kostyantyn Vorobyov
Browse files
Options
Downloads
Patches
Plain Diff
Replaced tracking jumps with a stack instead of a list
Moved data structure manipulating functions out of the object
parent
f8526c77
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/e-acsl/exit_points.ml
+24
-23
24 additions, 23 deletions
src/plugins/e-acsl/exit_points.ml
with
24 additions
and
23 deletions
src/plugins/e-acsl/exit_points.ml
+
24
−
23
View file @
79299124
...
@@ -64,9 +64,18 @@ let filter_vars varlst1 varlst2 =
...
@@ -64,9 +64,18 @@ let filter_vars varlst1 varlst2 =
let
find_locals
stmt
=
let
find_locals
stmt
=
Stmt
.
Hashtbl
.
find
statement_locals
stmt
Stmt
.
Hashtbl
.
find
statement_locals
stmt
let
add_locals
stmt
locals
=
Stmt
.
Hashtbl
.
replace
statement_locals
stmt
locals
let
add_exit
stmt
from
=
Stmt
.
Hashtbl
.
replace
exit_context
stmt
from
let
find_exit
stmt
=
let
find_exit
stmt
=
Stmt
.
Hashtbl
.
find
exit_context
stmt
Stmt
.
Hashtbl
.
find
exit_context
stmt
let
add_labelled
label
goto
=
Stmt
.
Hashtbl
.
add
labelled_jumps
label
goto
let
delete_vars
stmt
=
let
delete_vars
stmt
=
match
stmt
.
skind
with
match
stmt
.
skind
with
|
Goto
(
_
)
|
Break
(
_
)
|
Continue
(
_
)
->
|
Goto
(
_
)
|
Break
(
_
)
|
Continue
(
_
)
->
...
@@ -86,24 +95,16 @@ let store_vars stmt =
...
@@ -86,24 +95,16 @@ let store_vars stmt =
else
else
[]
[]
class
jump_context
=
object
(
self
)
class
jump_context
=
object
(
_
)
inherit
Visitor
.
frama_c_inplace
inherit
Visitor
.
frama_c_inplace
val
mutable
locals
=
[[]]
val
mutable
locals
=
[[]]
(* Maintained list of local variables within a scope of a visitor,
(* Maintained list of local variables within the scope of a currently
variables within a single scope are given by a single list *)
visited statement. Variables within a single scope are given by a
single list *)
val
mutable
jumps
=
[]
(* Stack of entered switches and loops *)
method
private
add_locals
stmt
=
Stmt
.
Hashtbl
.
replace
statement_locals
stmt
(
List
.
flatten
locals
)
method
private
add_exit
stmt
from
=
Stmt
.
Hashtbl
.
replace
exit_context
stmt
from
method
private
add_labelled
label
goto
=
val
jumps
=
Stack
.
create
()
St
mt
.
Hashtbl
.
add
labelled_jumps
label
goto
(*
St
ack of entered switches and loops *)
method
!
vblock
blk
=
method
!
vblock
blk
=
locals
<-
[
blk
.
blocals
]
@
locals
;
locals
<-
[
blk
.
blocals
]
@
locals
;
...
@@ -113,20 +114,20 @@ class jump_context = object (self)
...
@@ -113,20 +114,20 @@ class jump_context = object (self)
method
!
vstmt
stmt
=
method
!
vstmt
stmt
=
match
stmt
.
skind
with
match
stmt
.
skind
with
|
Loop
(
_
)
|
Switch
(
_
)
->
|
Loop
(
_
)
|
Switch
(
_
)
->
self
#
add_locals
stmt
;
add_locals
stmt
(
List
.
flatten
locals
)
;
jumps
<-
stmt
::
jumps
;
Stack
.
push
stmt
jumps
;
Cil
.
DoChildrenPost
(
fun
st
->
jumps
<-
List
.
tl
jumps
;
st
)
Cil
.
DoChildrenPost
(
fun
st
->
let
_
=
Stack
.
pop
jumps
in
st
)
|
Break
(
_
)
|
Continue
(
_
)
->
|
Break
(
_
)
|
Continue
(
_
)
->
self
#
add_exit
stmt
(
List
.
hd
jumps
);
add_exit
stmt
(
Stack
.
top
jumps
);
self
#
add_locals
stmt
;
add_locals
stmt
(
List
.
flatten
locals
)
;
Cil
.
DoChildren
Cil
.
DoChildren
|
Goto
(
sref
,
_
)
->
|
Goto
(
sref
,
_
)
->
self
#
add_locals
stmt
;
add_locals
stmt
(
List
.
flatten
locals
)
;
self
#
add_exit
stmt
!
sref
;
add_exit
stmt
!
sref
;
self
#
add_labelled
!
sref
stmt
;
add_labelled
!
sref
stmt
;
Cil
.
DoChildren
Cil
.
DoChildren
|
_
when
(
List
.
length
stmt
.
labels
)
>
0
->
|
_
when
(
List
.
length
stmt
.
labels
)
>
0
->
self
#
add_locals
stmt
;
add_locals
stmt
(
List
.
flatten
locals
)
;
Cil
.
DoChildren
Cil
.
DoChildren
|
_
->
Cil
.
DoChildren
|
_
->
Cil
.
DoChildren
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