Skip to content

Commit 5ea86b5

Browse files
author
Remi Delmas
committed
CONTRACTS: remove mentions of DSL-style contracts
1 parent bec8f4e commit 5ea86b5

12 files changed

+195
-281
lines changed

src/goto-instrument/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ SRC = accelerate/accelerate.cpp \
2323
contracts/dynamic-frames/dfcc_is_freeable.cpp \
2424
contracts/dynamic-frames/dfcc_instrument.cpp \
2525
contracts/dynamic-frames/dfcc_spec_functions.cpp \
26-
contracts/dynamic-frames/dfcc_dsl_contract_functions.cpp \
27-
contracts/dynamic-frames/dfcc_dsl_wrapper_program.cpp \
28-
contracts/dynamic-frames/dfcc_dsl_contract_handler.cpp \
26+
contracts/dynamic-frames/dfcc_contract_functions.cpp \
27+
contracts/dynamic-frames/dfcc_wrapper_program.cpp \
28+
contracts/dynamic-frames/dfcc_contract_handler.cpp \
2929
contracts/dynamic-frames/dfcc_swap_and_wrap.cpp \
3030
contracts/dynamic-frames/dfcc.cpp \
3131
contracts/havoc_assigns_clause_targets.cpp \

src/goto-instrument/contracts/doc/developer/contracts-dev-arch.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ Each of these translation passes is implemented in a specific class:
3030
@ref dfcc_is_fresht | Implements @ref contracts-dev-spec-is-fresh
3131
@ref dfcc_is_freeablet | Implements @ref contracts-dev-spec-is-freeable
3232
@ref dfcc_spec_functionst | Implements @ref contracts-dev-spec-spec-rewriting
33-
@ref dfcc_dsl_wrapper_programt | Implements @ref contracts-dev-spec-contract-checking for DSL-style contracts
34-
^ | Implements @ref contracts-dev-spec-contract-replacement for DSL-style contracts
35-
@ref dfcc_dsl_contract_handlert | Implements @ref contracts-dev-spec-codegen for DSL-style contracts
36-
^ | Implements the interface @ref dfcc_contract_handlert for DSL-style contract by delegating operations to @ref dfcc_dsl_wrapper_programt
33+
@ref dfcc_wrapper_programt | Implements @ref contracts-dev-spec-contract-checking for contracts
34+
^ | Implements @ref contracts-dev-spec-contract-replacement for contracts
35+
@ref dfcc_contract_handlert | Implements @ref contracts-dev-spec-codegen for contracts
36+
^ | Implements the interface @ref dfcc_contract_handlert for contract by delegating operations to @ref dfcc_wrapper_programt
3737
@ref dfcc_swap_and_wrapt | Implements @ref contracts-dev-spec-contract-checking by delegating basic operations to @ref dfcc_contract_handlert
3838
^ | Implements @ref contracts-dev-spec-contract-replacement by delegating basic operations to @ref dfcc_contract_handlert
3939
^ | Implements @ref contracts-dev-spec-contract-checking-rec by delegating basic operations to @ref dfcc_contract_handlert

src/goto-instrument/contracts/dynamic-frames/dfcc.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ dfcct::dfcct(
125125
ns(goto_model.symbol_table),
126126
instrument(goto_model, message_handler, utils, library),
127127
spec_functions(goto_model, message_handler, utils, library, instrument),
128-
dsl_contract_handler(
128+
contract_handler(
129129
goto_model,
130130
message_handler,
131131
utils,
@@ -139,7 +139,7 @@ dfcct::dfcct(
139139
library,
140140
instrument,
141141
spec_functions,
142-
dsl_contract_handler),
142+
contract_handler),
143143
max_assigns_clause_size(0)
144144
{
145145
transform_goto_model();
@@ -162,7 +162,7 @@ void dfcct::check_transform_goto_model_preconditions()
162162
"' either not found or has no body");
163163

164164
// triggers signature compatibility checking
165-
dsl_contract_handler.get_pure_contract_symbol(pair.second);
165+
contract_handler.get_pure_contract_symbol(pair.second);
166166

167167
PRECONDITION_WITH_DIAGNOSTICS(
168168
pair.first != harness_id,
@@ -194,7 +194,7 @@ void dfcct::check_transform_goto_model_preconditions()
194194
"Function to replace '" + id2string(pair.first) + "' not found");
195195

196196
// triggers signature compatibility checking
197-
dsl_contract_handler.get_pure_contract_symbol(pair.second);
197+
contract_handler.get_pure_contract_symbol(pair.second);
198198

199199
PRECONDITION_WITH_DIAGNOSTICS(
200200
pair.first != harness_id,
@@ -288,7 +288,7 @@ void dfcct::wrap_checked_function()
288288

289289
// upate max contract size
290290
const std::size_t assigns_clause_size =
291-
dsl_contract_handler.get_assigns_clause_size(contract_id);
291+
contract_handler.get_assigns_clause_size(contract_id);
292292
if(assigns_clause_size > max_assigns_clause_size)
293293
max_assigns_clause_size = assigns_clause_size;
294294
}
@@ -358,7 +358,7 @@ void dfcct::wrap_discovered_function_pointer_contracts()
358358
"Function pointer contract '" + str + "' not found.");
359359

360360
// triggers signature compatibility checking
361-
dsl_contract_handler.get_pure_contract_symbol(str);
361+
contract_handler.get_pure_contract_symbol(str);
362362

363363
log.status() << "Wrapping function pointer contract '" << fp_contract
364364
<< "' with itself in REPLACE mode" << messaget::eom;

src/goto-instrument/contracts/dynamic-frames/dfcc.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ Author: Remi Delmas, delmasrd@amazon.com
1717
/// \brief Main class orchestrating the the whole program transformation
1818
/// for function contracts with Dynamic Frame Condition Checking (DFCC)
1919
///
20-
/// Contracts must be expressed in DSL-style, i.e. as contract clauses attached
21-
/// to the function declaration at the C level.
22-
///
2320
/// All functions of the model are extended with a ghost parameter representing
2421
/// a dynamic frame and all their assignments are instrumented and checked
2522
/// against the dynamic frame parameter.
@@ -36,7 +33,6 @@ Author: Remi Delmas, delmasrd@amazon.com
3633
#include <util/message.h>
3734

3835
#include "dfcc_contract_handler.h"
39-
#include "dfcc_dsl_contract_handler.h"
4036
#include "dfcc_instrument.h"
4137
#include "dfcc_library.h"
4238
#include "dfcc_spec_functions.h"
@@ -203,7 +199,7 @@ class dfcct
203199
namespacet ns;
204200
dfcc_instrumentt instrument;
205201
dfcc_spec_functionst spec_functions;
206-
dfcc_dsl_contract_handlert dsl_contract_handler;
202+
dfcc_contract_handlert contract_handler;
207203
dfcc_swap_and_wrapt swap_and_wrap;
208204

209205
/// Maps wrapper function to the wrapped function.

src/goto-instrument/contracts/dynamic-frames/dfcc_dsl_contract_functions.cpp renamed to src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Author: Remi Delmas, delmasrd@amazon.com
66
Date: August 2022
77
88
\*******************************************************************/
9-
#include "dfcc_dsl_contract_functions.h"
9+
#include "dfcc_contract_functions.h"
1010

1111
#include <util/expr_util.h>
1212
#include <util/fresh_symbol.h>
@@ -26,7 +26,7 @@ Date: August 2022
2626
#include "dfcc_spec_functions.h"
2727
#include "dfcc_utils.h"
2828

29-
dfcc_dsl_contract_functionst::dfcc_dsl_contract_functionst(
29+
dfcc_contract_functionst::dfcc_contract_functionst(
3030
const symbolt &pure_contract_symbol,
3131
goto_modelt &goto_model,
3232
message_handlert &message_handler,
@@ -66,34 +66,33 @@ dfcc_dsl_contract_functionst::dfcc_dsl_contract_functionst(
6666
}
6767

6868
const symbolt &
69-
dfcc_dsl_contract_functionst::get_spec_assigns_function_symbol() const
69+
dfcc_contract_functionst::get_spec_assigns_function_symbol() const
7070
{
7171
return ns.lookup(spec_assigns_function_id);
7272
}
7373

7474
const symbolt &
75-
dfcc_dsl_contract_functionst::get_spec_assigns_havoc_function_symbol() const
75+
dfcc_contract_functionst::get_spec_assigns_havoc_function_symbol() const
7676
{
7777
return ns.lookup(spec_assigns_havoc_function_id);
7878
}
7979

80-
const symbolt &
81-
dfcc_dsl_contract_functionst::get_spec_frees_function_symbol() const
80+
const symbolt &dfcc_contract_functionst::get_spec_frees_function_symbol() const
8281
{
8382
return ns.lookup(spec_frees_function_id);
8483
}
8584

86-
const std::size_t dfcc_dsl_contract_functionst::get_nof_assigns_targets() const
85+
const std::size_t dfcc_contract_functionst::get_nof_assigns_targets() const
8786
{
8887
return nof_assigns_targets;
8988
}
9089

91-
const std::size_t dfcc_dsl_contract_functionst::get_nof_frees_targets() const
90+
const std::size_t dfcc_contract_functionst::get_nof_frees_targets() const
9291
{
9392
return nof_frees_targets;
9493
}
9594

96-
void dfcc_dsl_contract_functionst::gen_spec_assigns_function()
95+
void dfcc_contract_functionst::gen_spec_assigns_function()
9796
{
9897
const auto &spec_function_symbol = utils.clone_and_rename_function(
9998
pure_contract_symbol.name, spec_assigns_function_id, empty_typet());
@@ -151,7 +150,7 @@ void dfcc_dsl_contract_functionst::gen_spec_assigns_function()
151150
goto_model.goto_functions.update();
152151
}
153152

154-
void dfcc_dsl_contract_functionst::encode_assignable_target_group(
153+
void dfcc_contract_functionst::encode_assignable_target_group(
155154
const conditional_target_group_exprt &group,
156155
goto_programt &dest)
157156
{
@@ -174,7 +173,7 @@ void dfcc_dsl_contract_functionst::encode_assignable_target_group(
174173
goto_instruction->complete_goto(label_instruction);
175174
}
176175

177-
void dfcc_dsl_contract_functionst::encode_assignable_target(
176+
void dfcc_contract_functionst::encode_assignable_target(
178177
const exprt &target,
179178
goto_programt &dest)
180179
{
@@ -236,7 +235,7 @@ void dfcc_dsl_contract_functionst::encode_assignable_target(
236235
}
237236
}
238237

239-
void dfcc_dsl_contract_functionst::gen_spec_frees_function()
238+
void dfcc_contract_functionst::gen_spec_frees_function()
240239
{
241240
// fetch pure contract symbol
242241
const auto &code_with_contract =
@@ -300,7 +299,7 @@ void dfcc_dsl_contract_functionst::gen_spec_frees_function()
300299
goto_model.goto_functions.update();
301300
}
302301

303-
void dfcc_dsl_contract_functionst::inline_and_check_warnings(
302+
void dfcc_contract_functionst::inline_and_check_warnings(
304303
const irep_idt &function_id)
305304
{
306305
std::set<irep_idt> no_body;
@@ -341,7 +340,7 @@ void dfcc_dsl_contract_functionst::inline_and_check_warnings(
341340
"not enough arguments when inlining '" + id2string(function_id) + "'");
342341
}
343342

344-
void dfcc_dsl_contract_functionst::encode_freeable_target_group(
343+
void dfcc_contract_functionst::encode_freeable_target_group(
345344
const conditional_target_group_exprt &group,
346345
goto_programt &dest)
347346
{
@@ -364,7 +363,7 @@ void dfcc_dsl_contract_functionst::encode_freeable_target_group(
364363
goto_instruction->complete_goto(label_instruction);
365364
}
366365

367-
void dfcc_dsl_contract_functionst::encode_freeable_target(
366+
void dfcc_contract_functionst::encode_freeable_target(
368367
const exprt &target,
369368
goto_programt &dest)
370369
{

src/goto-instrument/contracts/dynamic-frames/dfcc_dsl_contract_functions.h renamed to src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Date: August 2022
1111
/// Translates assigns and frees clauses of a function contract into goto
1212
/// functions that allow to build and havoc write sets dynamically.
1313

14-
#ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_DSL_CONTRACT_FUNCTIONS_H
15-
#define CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_DSL_CONTRACT_FUNCTIONS_H
14+
#ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_CONTRACT_FUNCTIONS_H
15+
#define CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_CONTRACT_FUNCTIONS_H
1616

1717
#include <goto-programs/goto_convert_class.h>
1818

@@ -59,7 +59,7 @@ class function_pointer_obeys_contract_exprt;
5959
/// write_set_to_fill,
6060
/// write_set_to_check);
6161
/// ```
62-
class dfcc_dsl_contract_functionst
62+
class dfcc_contract_functionst
6363
{
6464
public:
6565
/// \param pure_contract_symbol the contract to generate code from
@@ -69,7 +69,7 @@ class dfcc_dsl_contract_functionst
6969
/// \param library the contracts instrumentation library
7070
/// \param spec_functions provides translation methods for assignable set
7171
/// or freeable set specification functions.
72-
dfcc_dsl_contract_functionst(
72+
dfcc_contract_functionst(
7373
const symbolt &pure_contract_symbol,
7474
goto_modelt &goto_model,
7575
message_handlert &message_handler,

src/goto-instrument/contracts/dynamic-frames/dfcc_dsl_contract_handler.cpp renamed to src/goto-instrument/contracts/dynamic-frames/dfcc_contract_handler.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Date: August 2022
77
88
\*******************************************************************/
99

10-
#include "dfcc_dsl_contract_handler.h"
10+
#include "dfcc_contract_handler.h"
1111

1212
#include <util/arith_tools.h>
1313
#include <util/c_types.h>
@@ -29,16 +29,16 @@ Date: August 2022
2929
#include <goto-instrument/contracts/utils.h>
3030
#include <langapi/language_util.h>
3131

32-
#include "dfcc_dsl_wrapper_program.h"
3332
#include "dfcc_instrument.h"
3433
#include "dfcc_library.h"
3534
#include "dfcc_spec_functions.h"
3635
#include "dfcc_utils.h"
36+
#include "dfcc_wrapper_program.h"
3737

38-
std::map<irep_idt, dfcc_dsl_contract_functionst>
39-
dfcc_dsl_contract_handlert::contract_cache;
38+
std::map<irep_idt, dfcc_contract_functionst>
39+
dfcc_contract_handlert::contract_cache;
4040

41-
dfcc_dsl_contract_handlert::dfcc_dsl_contract_handlert(
41+
dfcc_contract_handlert::dfcc_contract_handlert(
4242
goto_modelt &goto_model,
4343
message_handlert &message_handler,
4444
dfcc_utilst &utils,
@@ -56,20 +56,20 @@ dfcc_dsl_contract_handlert::dfcc_dsl_contract_handlert(
5656
{
5757
}
5858

59-
const dfcc_dsl_contract_functionst &
60-
dfcc_dsl_contract_handlert::get_contract_functions(const irep_idt &contract_id)
59+
const dfcc_contract_functionst &
60+
dfcc_contract_handlert::get_contract_functions(const irep_idt &contract_id)
6161
{
62-
auto iter = dfcc_dsl_contract_handlert::contract_cache.find(contract_id);
62+
auto iter = dfcc_contract_handlert::contract_cache.find(contract_id);
6363

6464
// return existing value
65-
if(iter != dfcc_dsl_contract_handlert::contract_cache.end())
65+
if(iter != dfcc_contract_handlert::contract_cache.end())
6666
return iter->second;
6767

6868
// insert new value
69-
return dfcc_dsl_contract_handlert::contract_cache
69+
return dfcc_contract_handlert::contract_cache
7070
.insert(
7171
{contract_id,
72-
dfcc_dsl_contract_functionst(
72+
dfcc_contract_functionst(
7373
get_pure_contract_symbol(contract_id),
7474
goto_model,
7575
message_handler,
@@ -80,12 +80,12 @@ dfcc_dsl_contract_handlert::get_contract_functions(const irep_idt &contract_id)
8080
}
8181

8282
const std::size_t
83-
dfcc_dsl_contract_handlert::get_assigns_clause_size(const irep_idt &contract_id)
83+
dfcc_contract_handlert::get_assigns_clause_size(const irep_idt &contract_id)
8484
{
8585
return get_contract_functions(contract_id).get_nof_assigns_targets();
8686
}
8787

88-
void dfcc_dsl_contract_handlert::add_contract_instructions(
88+
void dfcc_contract_handlert::add_contract_instructions(
8989
const dfcc_contract_modet contract_mode,
9090
const irep_idt &wrapper_id,
9191
const irep_idt &wrapped_id,
@@ -94,7 +94,7 @@ void dfcc_dsl_contract_handlert::add_contract_instructions(
9494
goto_programt &dest,
9595
std::set<irep_idt> &function_pointer_contracts)
9696
{
97-
dfcc_dsl_wrapper_programt(
97+
dfcc_wrapper_programt(
9898
contract_mode,
9999
utils.get_function_symbol(wrapper_id),
100100
utils.get_function_symbol(wrapped_id),
@@ -108,8 +108,8 @@ void dfcc_dsl_contract_handlert::add_contract_instructions(
108108
.add_to_dest(dest, function_pointer_contracts);
109109
}
110110

111-
const symbolt &dfcc_dsl_contract_handlert::get_pure_contract_symbol(
112-
const irep_idt &contract_id)
111+
const symbolt &
112+
dfcc_contract_handlert::get_pure_contract_symbol(const irep_idt &contract_id)
113113
{
114114
const auto &contract_symbol = utils.get_function_symbol(contract_id);
115115
auto pure_contract_id = "contract::" + id2string(contract_id);
@@ -149,7 +149,7 @@ const symbolt &dfcc_dsl_contract_handlert::get_pure_contract_symbol(
149149
}
150150
}
151151

152-
void dfcc_dsl_contract_handlert::check_signature_compat(
152+
void dfcc_contract_handlert::check_signature_compat(
153153
const irep_idt &contract_id,
154154
const code_typet &contract_type,
155155
const irep_idt &pure_contract_id,
@@ -162,7 +162,7 @@ void dfcc_dsl_contract_handlert::check_signature_compat(
162162
if(!compatible)
163163
{
164164
std::ostringstream err_msg;
165-
err_msg << "dfcc_dsl_contract_handlert: function '" << contract_id
165+
err_msg << "dfcc_contract_handlert: function '" << contract_id
166166
<< "' and the corresponding pure contract symbol '"
167167
<< pure_contract_id << "' have incompatible type signatures:\n";
168168

0 commit comments

Comments
 (0)