Skip to content

Commit 9e31303

Browse files
committed
Symex: switch to incrementally populating address-taken locals
This populates address-taken locals as each function is first encountered, rather than analysing every function up front. This lays the groundwork for moving to incremental function loading.
1 parent ac5af68 commit 9e31303

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/goto-symex/goto_symex_state.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Author: Daniel Kroening, [email protected]
2626

2727
#include "symex_target.h"
2828

29-
class dirtyt;
29+
class incremental_dirtyt;
3030

3131
// central data structure: state
3232
class goto_symex_statet final
@@ -340,9 +340,12 @@ class goto_symex_statet final
340340
bool l2_thread_read_encoding(ssa_exprt &expr, const namespacet &ns);
341341
bool l2_thread_write_encoding(const ssa_exprt &expr, const namespacet &ns);
342342

343+
void populate_dirty_for_function(
344+
const irep_idt &id, const goto_functionst::goto_functiont &);
345+
343346
void switch_to_thread(unsigned t);
344347
bool record_events;
345-
std::unique_ptr<const dirtyt> dirty;
348+
std::unique_ptr<incremental_dirtyt> dirty;
346349
};
347350

348351
#endif // CPROVER_GOTO_SYMEX_GOTO_SYMEX_STATE_H

src/goto-symex/symex_function_call.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ void goto_symext::symex_function_call_code(
235235

236236
const goto_functionst::goto_functiont &goto_function=it->second;
237237

238+
if(state.dirty)
239+
state.dirty->populate_dirty_for_function(identifier, goto_function);
240+
238241
const bool stop_recursing=get_unwind_recursion(
239242
identifier,
240243
state.source.thread_nr,

src/goto-symex/symex_main.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,17 @@ void goto_symext::initialize_entry_point(
136136
state.top().end_of_function=limit;
137137
state.top().calling_location.pc=state.top().end_of_function;
138138
state.symex_target=&target;
139-
state.dirty=util_make_unique<dirtyt>(goto_functions);
140-
139+
state.dirty=util_make_unique<incremental_dirtyt>();
140+
if(!pc->function.empty())
141+
{
142+
state.dirty->populate_dirty_for_function(
143+
pc->function, goto_functions.function_map.at(pc->function));
144+
}
145+
else
146+
{
147+
log.warning() << "Unable to analyse address-taken locals, as start "
148+
"instruction does not state its function" << messaget::eom;
149+
}
141150
symex_transition(state, state.source.pc);
142151
}
143152

0 commit comments

Comments
 (0)