Skip to content

Commit 2336995

Browse files
committed
Remove string lookups from goto_symext main loop
Lookups into goto_symext's options member have been replaced by accesses to instance members that are initialized from the optionst reference by goto_symext's constructor. This commit fixes diffblue#2050.
1 parent 5720ead commit 2336995

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/goto-symex/goto_symex.h

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class goto_symext
5656
path_storaget &path_storage)
5757
: should_pause_symex(false),
5858
options(options),
59+
max_depth(options.get_unsigned_int_option("depth")),
60+
doing_path_exploration(options.is_set("paths")),
5961
total_vccs(0),
6062
remaining_vccs(0),
6163
constant_propagation(true),
@@ -196,6 +198,9 @@ class goto_symext
196198

197199
const optionst &options;
198200

201+
const unsigned max_depth;
202+
const bool doing_path_exploration;
203+
199204
public:
200205
// these bypass the target maps
201206
virtual void symex_step_goto(statet &, bool taken);

src/goto-symex/symex_goto.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void goto_symext::symex_goto(statet &state)
111111
(simpl_state_guard.is_true() ||
112112
// or there is another block, but we're doing path exploration so
113113
// we're going to skip over it for now and return to it later.
114-
options.get_bool_option("paths")))
114+
doing_path_exploration))
115115
{
116116
DATA_INVARIANT(
117117
instruction.targets.size() > 0,
@@ -178,7 +178,7 @@ void goto_symext::symex_goto(statet &state)
178178
log.debug() << "Resuming from next instruction '"
179179
<< state_pc->source_location << "'" << log.eom;
180180
}
181-
else if(options.get_bool_option("paths"))
181+
else if(doing_path_exploration)
182182
{
183183
// We should save both the instruction after this goto, and the target of
184184
// the goto.

src/goto-symex/symex_main.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,13 @@ void goto_symext::symex_step(
308308

309309
const goto_programt::instructiont &instruction=*state.source.pc;
310310

311-
if(!options.get_bool_option("paths"))
311+
if(!doing_path_exploration)
312312
merge_gotos(state);
313313

314314
// depth exceeded?
315-
{
316-
unsigned max_depth=options.get_unsigned_int_option("depth");
317-
if(max_depth!=0 && state.depth>max_depth)
318-
state.guard.add(false_exprt());
319-
state.depth++;
320-
}
315+
if(max_depth != 0 && state.depth > max_depth)
316+
state.guard.add(false_exprt());
317+
state.depth++;
321318

322319
// actually do instruction
323320
switch(instruction.type)

0 commit comments

Comments
 (0)