Skip to content

Commit e77cabc

Browse files
committed
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 34a3d85 commit e77cabc

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)
@@ -148,7 +153,12 @@ class bmct:public safety_checkert
148153
ns(outer_symbol_table),
149154
equation(_equation),
150155
path_storage(_path_storage),
151-
symex(_message_handler, outer_symbol_table, equation, path_storage),
156+
symex(
157+
_message_handler,
158+
outer_symbol_table,
159+
equation,
160+
options,
161+
path_storage),
152162
prop_conv(_prop_conv),
153163
ui(ui_message_handlert::uit::PLAIN),
154164
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),
@@ -66,8 +68,6 @@ class goto_symext
6668
guard_identifier("goto_symex::\\guard"),
6769
path_storage(path_storage)
6870
{
69-
options.set_option("simplify", true);
70-
options.set_option("assertions", true);
7171
}
7272

7373
virtual ~goto_symext()
@@ -194,6 +194,8 @@ class goto_symext
194194
const get_goto_functiont &,
195195
statet &);
196196

197+
const optionst &options;
198+
197199
public:
198200
// these bypass the target maps
199201
virtual void symex_step_goto(statet &, bool taken);
@@ -203,8 +205,6 @@ class goto_symext
203205

204206
bool constant_propagation;
205207

206-
optionst options;
207-
208208
/// language_mode: ID_java, ID_C or another language identifier
209209
/// if we know the source language in use, irep_idt() otherwise.
210210
irep_idt language_mode;

0 commit comments

Comments
 (0)