Skip to content

Commit 08162b6

Browse files
committed
Make recording of branches possible
symex_bmct may now re-implement merge_goto to observe each merge, just like loop unwinding is reported.
1 parent c8687e7 commit 08162b6

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

src/goto-symex/goto_symex.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ class goto_symext
175175
// gotos
176176
void merge_gotos(statet &state);
177177

178+
virtual void merge_goto(
179+
const statet::goto_statet &goto_state,
180+
statet &state);
181+
178182
void merge_value_sets(
179183
const statet::goto_statet &goto_state,
180184
statet &dest);

src/goto-symex/goto_symex_state.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ class goto_symex_statet
189189
level2t::current_namest level2_current_names;
190190
value_sett value_set;
191191
guardt guard;
192+
symex_targett::sourcet source;
192193
propagationt propagation;
193194
unsigned atomic_section_id;
194195

@@ -197,6 +198,7 @@ class goto_symex_statet
197198
level2_current_names(s.level2.current_names),
198199
value_set(s.value_set),
199200
guard(s.guard),
201+
source(s.source),
200202
propagation(s.propagation),
201203
atomic_section_id(s.atomic_section_id)
202204
{

src/goto-symex/symex_goto.cpp

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ void goto_symext::symex_goto(statet &state)
121121
state_pc=goto_target;
122122
}
123123

124-
state.source.pc=state_pc;
125-
126124
// put into state-queue
127125
statet::goto_state_listt &goto_state_list=
128126
state.top().goto_state_map[new_state_pc];
129127

130128
goto_state_list.push_back(statet::goto_statet(state));
131129
statet::goto_statet &new_state=goto_state_list.back();
132130

131+
state.source.pc=state_pc;
132+
133133
// adjust guards
134134
if(new_guard.is_true())
135135
{
@@ -244,27 +244,42 @@ void goto_symext::merge_gotos(statet &state)
244244
list_it=state_list.rbegin();
245245
list_it!=state_list.rend();
246246
list_it++)
247-
{
248-
statet::goto_statet &goto_state=*list_it;
247+
merge_goto(*list_it, state);
249248

250-
// check atomic section
251-
if(state.atomic_section_id!=goto_state.atomic_section_id)
252-
throw "atomic sections differ across branches";
249+
// clean up to save some memory
250+
frame.goto_state_map.erase(state_map_it);
251+
}
253252

254-
// do SSA phi functions
255-
phi_function(goto_state, state);
253+
/*******************************************************************\
256254
257-
merge_value_sets(goto_state, state);
255+
Function: goto_symext::merge_goto
258256
259-
// adjust guard
260-
state.guard|=goto_state.guard;
257+
Inputs:
261258
262-
// adjust depth
263-
state.depth=std::min(state.depth, goto_state.depth);
264-
}
259+
Outputs:
265260
266-
// clean up to save some memory
267-
frame.goto_state_map.erase(state_map_it);
261+
Purpose:
262+
263+
\*******************************************************************/
264+
265+
void goto_symext::merge_goto(
266+
const statet::goto_statet &goto_state,
267+
statet &state)
268+
{
269+
// check atomic section
270+
if(state.atomic_section_id!=goto_state.atomic_section_id)
271+
throw "atomic sections differ across branches";
272+
273+
// do SSA phi functions
274+
phi_function(goto_state, state);
275+
276+
merge_value_sets(goto_state, state);
277+
278+
// adjust guard
279+
state.guard|=goto_state.guard;
280+
281+
// adjust depth
282+
state.depth=std::min(state.depth, goto_state.depth);
268283
}
269284

270285
/*******************************************************************\

0 commit comments

Comments
 (0)