Skip to content

Commit cfb5f34

Browse files
karkhazDegiorgio
authored andcommitted
Remove optionst member from goto_symext
goto_symext now has a const reference rather than owning a member. There is no need to copy an optionst by value from bmct.
1 parent e8ff243 commit cfb5f34

File tree

6 files changed

+25
-9
lines changed

6 files changed

+25
-9
lines changed

src/cbmc/bmc.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ void bmct::get_memory_model()
305305
void bmct::setup()
306306
{
307307
get_memory_model();
308-
symex.options=options;
309308

310309
{
311310
const symbolt *init_symbol;

src/cbmc/bmc.h

+12-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ class bmct:public safety_checkert
7676
ns(outer_symbol_table, symex_symbol_table),
7777
equation(),
7878
path_storage(_path_storage),
79-
symex(_message_handler, outer_symbol_table, equation, path_storage),
79+
symex(
80+
_message_handler,
81+
outer_symbol_table,
82+
equation,
83+
options,
84+
path_storage),
8085
prop_conv(_prop_conv),
8186
ui(ui_message_handlert::uit::PLAIN),
8287
driver_callback_after_symex(callback_after_symex)
@@ -150,7 +155,12 @@ class bmct:public safety_checkert
150155
ns(outer_symbol_table),
151156
equation(_equation),
152157
path_storage(_path_storage),
153-
symex(_message_handler, outer_symbol_table, equation, path_storage),
158+
symex(
159+
_message_handler,
160+
outer_symbol_table,
161+
equation,
162+
options,
163+
path_storage),
154164
prop_conv(_prop_conv),
155165
ui(ui_message_handlert::uit::PLAIN),
156166
driver_callback_after_symex(callback_after_symex)

src/cbmc/symex_bmc.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ symex_bmct::symex_bmct(
2222
message_handlert &mh,
2323
const symbol_tablet &outer_symbol_table,
2424
symex_target_equationt &_target,
25+
const optionst &options,
2526
path_storaget &path_storage)
26-
: goto_symext(mh, outer_symbol_table, _target, path_storage),
27+
: goto_symext(mh, outer_symbol_table, _target, options, path_storage),
2728
record_coverage(false),
2829
symex_coverage(ns)
2930
{

src/cbmc/symex_bmc.h

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class symex_bmct: public goto_symext
2929
message_handlert &mh,
3030
const symbol_tablet &outer_symbol_table,
3131
symex_target_equationt &_target,
32+
const optionst &options,
3233
path_storaget &path_storage);
3334

3435
// To show progress

src/goto-instrument/accelerate/scratch_program.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,16 @@ class scratch_programt:public goto_programt
4343
ns(symbol_table, symex_symbol_table),
4444
equation(),
4545
path_storage(),
46-
symex(mh, symbol_table, equation, path_storage),
46+
options(),
47+
symex(mh, symbol_table, equation, options, path_storage),
4748
satcheck(util_make_unique<satcheckt>()),
4849
satchecker(ns, *satcheck),
4950
z3(ns, "accelerate", "", "", smt2_dect::solvert::Z3),
5051
checker(&z3) // checker(&satchecker)
5152
{
53+
// Unconditionally set for performance reasons. This option setting applies
54+
// only to this program.
55+
options.set_option("simplify", true);
5256
}
5357

5458
void append(goto_programt::instructionst &instructions);
@@ -80,6 +84,7 @@ class scratch_programt:public goto_programt
8084
namespacet ns;
8185
symex_target_equationt equation;
8286
path_fifot path_storage;
87+
optionst options;
8388
goto_symext symex;
8489

8590
std::unique_ptr<propt> satcheck;

src/goto-symex/goto_symex.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ class goto_symext
5252
message_handlert &mh,
5353
const symbol_tablet &outer_symbol_table,
5454
symex_target_equationt &_target,
55+
const optionst &options,
5556
path_storaget &path_storage)
5657
: should_pause_symex(false),
58+
options(options),
5759
total_vccs(0),
5860
remaining_vccs(0),
5961
constant_propagation(true),
@@ -67,8 +69,6 @@ class goto_symext
6769
guard_identifier("goto_symex::\\guard"),
6870
path_storage(path_storage)
6971
{
70-
options.set_option("simplify", true);
71-
options.set_option("assertions", true);
7272
}
7373

7474
virtual ~goto_symext()
@@ -195,6 +195,8 @@ class goto_symext
195195
const get_goto_functiont &,
196196
statet &);
197197

198+
const optionst &options;
199+
198200
public:
199201
// these bypass the target maps
200202
virtual void symex_step_goto(statet &, bool taken);
@@ -205,8 +207,6 @@ class goto_symext
205207
bool constant_propagation;
206208
bool self_loops_to_assumptions;
207209

208-
optionst options;
209-
210210
/// language_mode: ID_java, ID_C or another language identifier
211211
/// if we know the source language in use, irep_idt() otherwise.
212212
irep_idt language_mode;

0 commit comments

Comments
 (0)