Skip to content

Commit 2675090

Browse files
committed
Add documentation for object numbering
1 parent dbd6988 commit 2675090

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/pointer-analysis/README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Folder pointer-analysis
55

6-
\author Martin Brain
6+
\author Martin Brain, Chris Smowton
77

88
To perform symbolic execution on programs with dereferencing of
99
arbitrary pointers, some alias analysis is needed. `pointer-analysis`
@@ -15,7 +15,20 @@ subtle and sophisticated and thus there may be bugs.
1515

1616
\subsection pointer-analysis-object-numbering Object / expression numbering (object_numberingt)
1717

18-
To be documented.
18+
Object numbering assigns numbers to expressions, allowing other pointer-analysis
19+
classes to use small, cheap to compare, cheap to sort numbers in place of
20+
\ref exprt instances. Numbering also saves memory, as two identical exprt
21+
objects will be assigned the same number, eliminating redundant storage of the
22+
same data.
23+
24+
Alternative approaches to the same problem include \ref irept sharing (but this
25+
only shares when a copy is taken; two identical irepts arrived at by different
26+
routes will not be shared) and \ref merge_irept (which does merge identical
27+
ireps, but is still more expensive to compare than numbers).
28+
29+
Object numbering is used by \ref value_sett and cousins (such as
30+
\ref value_set_fit) in an effort to reduce the memory dedicated to value-set
31+
storage.
1932

2033
\subsection pointer-analysis-pointer-offset-sum Pointer-offset sum (pointer_offset_sum)
2134

src/pointer-analysis/object_numbering.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
/*******************************************************************\
22
3-
Module: Value Set
3+
Module: Object Numbering
44
55
Author: Daniel Kroening, [email protected]
66
77
\*******************************************************************/
88

99
/// \file
10-
/// Value Set
10+
/// Object Numbering
11+
///
12+
/// This is used to abbreviate identical expressions by number: for example,
13+
/// an object_numberingt instance might maintain the map:
14+
/// ```
15+
/// 1 -> constant_exprt("Hello", string_typet())
16+
/// 2 -> constant_exprt("World", string_typet())
17+
/// ```
18+
/// Then any users that agree to use the same object_numberingt instance as a
19+
/// common reference source can use '1' and '2' as shorthands for "Hello" and
20+
/// "World" respectively.
1121

1222
#ifndef CPROVER_POINTER_ANALYSIS_OBJECT_NUMBERING_H
1323
#define CPROVER_POINTER_ANALYSIS_OBJECT_NUMBERING_H

0 commit comments

Comments
 (0)