@@ -66,11 +66,12 @@ void static_analysis_baset::operator()(
6666}
6767
6868void static_analysis_baset::operator ()(
69+ const irep_idt &function_identifier,
6970 const goto_programt &goto_program)
7071{
7172 initialize (goto_program);
7273 goto_functionst goto_functions;
73- fixedpoint (goto_program, goto_functions);
74+ fixedpoint (function_identifier, goto_program, goto_functions);
7475}
7576
7677void static_analysis_baset::output (
@@ -166,6 +167,7 @@ static_analysis_baset::locationt static_analysis_baset::get_next(
166167}
167168
168169bool static_analysis_baset::fixedpoint (
170+ const irep_idt &function_identifier,
169171 const goto_programt &goto_program,
170172 const goto_functionst &goto_functions)
171173{
@@ -184,14 +186,15 @@ bool static_analysis_baset::fixedpoint(
184186 {
185187 locationt l=get_next (working_set);
186188
187- if (visit (l, working_set, goto_program, goto_functions))
189+ if (visit (function_identifier, l, working_set, goto_program, goto_functions))
188190 new_data=true ;
189191 }
190192
191193 return new_data;
192194}
193195
194196bool static_analysis_baset::visit (
197+ const irep_idt &function_identifier,
195198 locationt l,
196199 working_sett &working_set,
197200 const goto_programt &goto_program,
@@ -220,14 +223,17 @@ bool static_analysis_baset::visit(
220223 to_code_function_call (l->code );
221224
222225 do_function_call_rec (
223- l, to_l,
226+ function_identifier,
227+ l,
228+ to_l,
224229 code.function (),
225230 code.arguments (),
226231 new_values,
227232 goto_functions);
228233 }
229234 else
230- new_values.transform (ns, l, to_l);
235+ new_values.transform (
236+ ns, function_identifier, l, function_identifier, to_l);
231237
232238 statet &other=get_state (to_l);
233239
@@ -245,7 +251,9 @@ bool static_analysis_baset::visit(
245251}
246252
247253void static_analysis_baset::do_function_call (
248- locationt l_call, locationt l_return,
254+ const irep_idt &calling_function,
255+ locationt l_call,
256+ locationt l_return,
249257 const goto_functionst &goto_functions,
250258 const goto_functionst::function_mapt::const_iterator f_it,
251259 const exprt::operandst &,
@@ -264,7 +272,7 @@ void static_analysis_baset::do_function_call(
264272
265273 // do the edge from the call site to the beginning of the function
266274 std::unique_ptr<statet> tmp_state (make_temporary_state (new_state));
267- tmp_state->transform (ns, l_call, l_begin);
275+ tmp_state->transform (ns, calling_function, l_call, f_it-> first , l_begin);
268276
269277 statet &begin_state=get_state (l_begin);
270278
@@ -286,7 +294,7 @@ void static_analysis_baset::do_function_call(
286294 if (new_data)
287295 {
288296 // recursive call
289- fixedpoint (goto_function.body , goto_functions);
297+ fixedpoint (f_it-> first , goto_function.body , goto_functions);
290298 }
291299 }
292300
@@ -301,7 +309,7 @@ void static_analysis_baset::do_function_call(
301309 // do edge from end of function to instruction after call
302310 std::unique_ptr<statet> tmp_state (
303311 make_temporary_state (end_of_function));
304- tmp_state->transform (ns, l_end, l_return);
312+ tmp_state->transform (ns, f_it-> first , l_end, calling_function , l_return);
305313
306314 // propagate those -- not exceedingly precise, this is,
307315 // as still it contains all the state from the
@@ -311,12 +319,15 @@ void static_analysis_baset::do_function_call(
311319
312320 {
313321 // effect on current procedure (if any)
314- new_state.transform (ns, l_call, l_return);
322+ new_state.transform (
323+ ns, calling_function, l_call, calling_function, l_return);
315324 }
316325}
317326
318327void static_analysis_baset::do_function_call_rec (
319- locationt l_call, locationt l_return,
328+ const irep_idt &calling_function,
329+ locationt l_call,
330+ locationt l_return,
320331 const exprt &function,
321332 const exprt::operandst &arguments,
322333 statet &new_state,
@@ -345,7 +356,9 @@ void static_analysis_baset::do_function_call_rec(
345356 throw " failed to find function " +id2string (identifier);
346357
347358 do_function_call (
348- l_call, l_return,
359+ calling_function,
360+ l_call,
361+ l_return,
349362 goto_functions,
350363 it,
351364 arguments,
@@ -361,14 +374,18 @@ void static_analysis_baset::do_function_call_rec(
361374 std::unique_ptr<statet> n2 (make_temporary_state (new_state));
362375
363376 do_function_call_rec (
364- l_call, l_return,
377+ calling_function,
378+ l_call,
379+ l_return,
365380 function.op1 (),
366381 arguments,
367382 new_state,
368383 goto_functions);
369384
370385 do_function_call_rec (
371- l_call, l_return,
386+ calling_function,
387+ l_call,
388+ l_return,
372389 function.op2 (),
373390 arguments,
374391 *n2,
@@ -392,7 +409,13 @@ void static_analysis_baset::do_function_call_rec(
392409 const object_descriptor_exprt &o=to_object_descriptor_expr (value);
393410 std::unique_ptr<statet> n2 (make_temporary_state (new_state));
394411 do_function_call_rec (
395- l_call, l_return, o.object (), arguments, *n2, goto_functions);
412+ calling_function,
413+ l_call,
414+ l_return,
415+ o.object (),
416+ arguments,
417+ *n2,
418+ goto_functions);
396419 merge (new_state, *n2, l_return);
397420 }
398421 }
@@ -424,7 +447,7 @@ void static_analysis_baset::sequential_fixedpoint(
424447
425448 forall_goto_functions (it, goto_functions)
426449 if (functions_done.insert (it->first ).second )
427- fixedpoint (it->second .body , goto_functions);
450+ fixedpoint (it->first , it-> second .body , goto_functions);
428451}
429452
430453void static_analysis_baset::concurrent_fixedpoint (
@@ -442,16 +465,32 @@ void static_analysis_baset::concurrent_fixedpoint(
442465 generate_state (sh_target);
443466 statet &shared_state=get_state (sh_target);
444467
445- typedef std::list<std::pair<goto_programt const *,
446- goto_programt::const_targett> > thread_wlt;
468+ struct wl_entryt
469+ {
470+ wl_entryt (
471+ const irep_idt &_function_identifier,
472+ const goto_programt &_goto_program,
473+ locationt _location)
474+ : function_identifier(_function_identifier),
475+ goto_program (&_goto_program),
476+ location(_location)
477+ {
478+ }
479+
480+ irep_idt function_identifier;
481+ const goto_programt *goto_program;
482+ locationt location;
483+ };
484+
485+ typedef std::list<wl_entryt> thread_wlt;
447486 thread_wlt thread_wl;
448487
449488 forall_goto_functions (it, goto_functions)
450489 forall_goto_program_instructions(t_it, it->second.body)
451490 {
452491 if (is_threaded (t_it))
453492 {
454- thread_wl.push_back (std::make_pair (&( it->second .body ) , t_it));
493+ thread_wl.push_back (wl_entryt ( it->first , it-> second .body , t_it));
455494
456495 goto_programt::const_targett l_end=
457496 it->second .body .instructions .end ();
@@ -472,16 +511,21 @@ void static_analysis_baset::concurrent_fixedpoint(
472511 for (const auto &thread : thread_wl)
473512 {
474513 working_sett working_set;
475- put_in_working_set (working_set, thread.second );
514+ put_in_working_set (working_set, thread.location );
476515
477- statet &begin_state= get_state (thread.second );
478- merge (begin_state, shared_state, thread.second );
516+ statet &begin_state = get_state (thread.location );
517+ merge (begin_state, shared_state, thread.location );
479518
480519 while (!working_set.empty ())
481520 {
482521 goto_programt::const_targett l=get_next (working_set);
483522
484- visit (l, working_set, *thread.first , goto_functions);
523+ visit (
524+ thread.function_identifier ,
525+ l,
526+ working_set,
527+ *thread.goto_program ,
528+ goto_functions);
485529
486530 // the underlying domain must make sure that the final state
487531 // carries all possible values; otherwise we would need to
0 commit comments