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
92c2a30b
Commit
92c2a30b
authored
8 years ago
by
Julien Signoles
Browse files
Options
Downloads
Patches
Plain Diff
[doc] explanation of Typing.Memo
parent
953dc568
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/typing.ml
+15
-0
15 additions, 0 deletions
src/plugins/e-acsl/typing.ml
with
15 additions
and
0 deletions
src/plugins/e-acsl/typing.ml
+
15
−
0
View file @
92c2a30b
...
@@ -110,6 +110,8 @@ type computed_info =
...
@@ -110,6 +110,8 @@ type computed_info =
must be casted to. If [None], no cast needed. *)
must be casted to. If [None], no cast needed. *)
}
}
(* Memoization module which retrieves the computed info of some terms. If the
info is already computed for a term, it is never recomputed *)
module
Memo
:
sig
module
Memo
:
sig
val
memo
:
(
term
->
computed_info
)
->
term
->
computed_info
val
memo
:
(
term
->
computed_info
)
->
term
->
computed_info
val
get
:
term
->
computed_info
val
get
:
term
->
computed_info
...
@@ -118,6 +120,19 @@ end = struct
...
@@ -118,6 +120,19 @@ end = struct
module
H
=
Hashtbl
.
Make
(
struct
module
H
=
Hashtbl
.
Make
(
struct
type
t
=
term
type
t
=
term
(* the comparison over terms is the physical equality. It cannot be the
structural one (given by [Cil_datatype.Term.equal]) because the very
same term can be used in 2 different contexts which lead to different
casts.
By construction, there are no physically equal terms in the AST
built by Cil. Consequently the memoisation should be fully
useless. However the translation of E-ACSL guarded quantification
generates new terms (see module {!Quantif}) which must be typed. The term
corresponding to the bound variable [x] is actually used twice: once in
the guard and once for encoding [x+1] when incrementing it. The
memoization is only useful here and indeed prevent the generation of
one extra variable in some cases. *)
let
equal
(
t1
:
term
)
t2
=
t1
==
t2
let
equal
(
t1
:
term
)
t2
=
t1
==
t2
let
hash
=
Cil_datatype
.
Term
.
hash
let
hash
=
Cil_datatype
.
Term
.
hash
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