1
- \page cpp-api-and-modularisation Libcprover -cpp and Modularisation
1
+ \page cpp-api-and-modularisation libcprover -cpp and Modularisation
2
2
3
3
** Date** : 22 Jun 2023
4
4
** Updated** : 22 Jun 2023
5
5
** Author
** : Fotis Koutoulakis,
[email protected]
6
6
** Domain** : Architecture, API
7
7
** Description** : This document outlines our thinking about the rearchitecting of
8
- CBMC using the C++ API (` Libcprover -cpp` ) as the central module and the
8
+ CBMC using the C++ API (` libcprover -cpp` ) as the central module and the
9
9
transitioning of other tools to use that as a basis.
10
10
11
11
## Motivation && Current State of Affairs
12
12
13
- CProver is a collection of tools fitting various program analysis needs. It
13
+ CProver is a collection of tools fitting various program analysis needs. CProver
14
14
has been the product of the evolution of the codebase of the model-checking
15
- tool for C (` CBMC ` ), after it has been adopted with various front-ends/back-ends
16
- and various auxilliary tools.
15
+ tool for C (` CBMC ` ). Since then CProver has been adopted with various
16
+ front-ends/back-ends and auxilliary tools.
17
17
18
18
During this time, the repository has grown organically, using some guidelines
19
19
for development that were based on tradition and intuition rather than some
20
- tight development guide . This development model has been successful for most
20
+ agreed architectural approach . This development model has been successful for most
21
21
of CProver's life, based on its nature as a hybrid industrial/academic and
22
- experimental/applied tool. However, it has had the side-effect of accruing
23
- some code duplication and technical debt. It has also made the codebase harder
24
- to understand/develop and integrate with, especially for someone who is new
25
- to the codebase.
22
+ experimental/applied tool. However, this has had the side-effect of accruing
23
+ some code duplication and technical debt. Consequently, the codebase is complex
24
+ and difficult to understand and develop for. This is a large barrier to new
25
+ developers, new features, and also improving and fixing the existing CProver
26
+ tools.
26
27
27
28
The above concerns have generated discussions about the breaking down of
28
29
CProver into modules, with cleaner interfaces and tighter boundary control
29
30
between them, making the code easier to integrate in other projects (by making
30
31
the various component modules easier to combine and reuse) and making the
31
32
codebase easier to understand and maintain.
32
33
34
+ The desire to separate functionality into different functional units
35
+ would also remove duplication and bloat, and prevent issues with the
36
+ same flag behaving in different ways across CProver tools.
37
+
33
38
## The Plan Going Forward
34
39
35
40
Given the above outline, we have reached a point where we are strongly motivated
36
- to take action to better componentise and modularise CProver.
37
-
38
- It's also an opportune time for us, given the existence of ` Libcprover-cpp `
41
+ to take action to better componentise and modularise CProver. What we mean by
42
+ "better componentise and modularise" is that right now, even though there
43
+ exists some structure between different CBMC components (at the class level
44
+ or at the code source file level), the different components aren't cleanly
45
+ separated in terms of boundaries/concerns, which hinders their reusability
46
+ or understandability.
47
+
48
+ It is also an opportune time for us, given the existence of ` libcprover-cpp `
39
49
the C++ API that we built to support interfacing with Rust (for now - other
40
50
languages may be coming in the future): we can use this as the basis of
41
51
development for an API exposing the interfaces of the various other modules
@@ -45,7 +55,7 @@ an incremental basis.
45
55
Of course, this is a project that is massive in scope, potentially being
46
56
exposed to further scope creep. We acknowledge that any effort to do what
47
57
we have discussed already is going to be a multi-year effort from our end,
48
- and that we will need community alignment to achieve the outcome we're
58
+ and that we will need community alignment to achieve the outcome we are
49
59
looking for.
50
60
51
61
This is why we are looking into testing the approach on a smaller component
@@ -66,38 +76,44 @@ The aim of the PR was not only to allow for the tool with the narrower-scope
66
76
to come to life, but also to see if we could expose just enough of the
67
77
process to the C++ API and use that as the basis of the new tool.
68
78
69
- This whole process has been very informational : we found out that not only
79
+ This whole process has been very informative : we found out that not only
70
80
we * can* use the C++ API in that capacity, but also that extending the API
71
81
as and when we need to, and doing the various refactorings to the other tools
72
82
on a Just-In-Time basis is viable.
73
83
74
84
There have been, however, some limitations:
75
85
76
86
* The C++ API is still nascent, and as such its support for various workflows
77
- is just not present (at first ). We can (and do) build things fast, as and
78
- when we need them - but it's nowhere near feature complete to provide for
87
+ is just not present (yet ). We can (and do) build things fast, as and
88
+ when we need them - but it is nowhere near feature complete to provide for
79
89
all of a user's workflows at the time of this writing.
80
90
91
+ * Still on the C++ API, its usage as the implementation basis for the new
92
+ tool ` goto-bmc ` means that the code-structure and patterns in ` goto-bmc `
93
+ are going to differ from other existing tools in the CProver-suite.
94
+
81
95
* CProver tools have primarily been based on textual output to report on the
82
96
results of their function (be it analysis, or transformations, etc). This
83
- hasn't been a problem up until this point (with the caveat that occassionally
97
+ has not been a problem up until this point (with the caveat that occasionally
84
98
requests for support of new textual formats come up and adding support for
85
99
those has become a laborious process).
86
100
87
- There's a need however for the separation of concerns between the production
101
+ There is a need however for the separation of concerns between the production
88
102
of the results by the analysis engine and the presentation layer for those.
89
103
90
- We're working towards addressing these teething problems, but while we're
104
+ We are working towards addressing these teething problems, but while we are
91
105
still operating on those, we have to accept some compromises in the architecture
92
- of the code while we're iterating or stabilising several of the new or
106
+ of the code while we are iterating or stabilising several of the new or
93
107
refactored parts.
94
108
95
109
Be advised that some constructs may pop up in some limited locations
96
- in the codebase that may appear questionable. We're only asking for
97
- some patience while we're working out the best way to refactor them into
110
+ in the codebase that may appear questionable. We are only asking for
111
+ some patience while we are working out the best way to refactor them into
98
112
an architecture that is more cohesive with the long term vision for the
99
113
platform.
100
114
101
115
From our end, we will do our best to avoid any spillover effects to
102
116
other areas of the codebase, and to avoid introducing any behavioural
103
- regressions while we're implementing the above plan.
117
+ regressions while we are implementing the above plan. Any constructs
118
+ that may feature "questionable" changes to parts will be marked as such
119
+ and be followed with an explanation as to why the decision was made.
0 commit comments