Skip to content

Commit 24743d1

Browse files
committed
JBMC: run replace-Java-nondet on function-by-function basis
1 parent 032b299 commit 24743d1

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/goto-programs/replace_java_nondet.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,16 @@ static void replace_java_nondet(goto_programt &goto_program)
235235
}
236236
}
237237

238+
void replace_java_nondet(goto_model_functiont &function)
239+
{
240+
goto_programt &program = function.get_goto_function().body;
241+
replace_java_nondet(program);
242+
243+
function.compute_location_numbers();
244+
245+
remove_skip(program);
246+
}
247+
238248
void replace_java_nondet(goto_functionst &goto_functions)
239249
{
240250
for(auto &goto_program : goto_functions.function_map)

src/goto-programs/replace_java_nondet.h

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Author: Reuben Thomas, [email protected]
1414

1515
class goto_modelt;
1616
class goto_functionst;
17+
class goto_model_functiont;
1718

1819
/// Replace calls to nondet library functions with an internal nondet
1920
/// representation.
@@ -22,4 +23,9 @@ void replace_java_nondet(goto_modelt &);
2223

2324
void replace_java_nondet(goto_functionst &);
2425

26+
/// Replace calls to nondet library functions with an internal nondet
27+
/// representation in a single function.
28+
/// \param function: The goto program to modify.
29+
void replace_java_nondet(goto_model_functiont &function);
30+
2531
#endif

src/jbmc/jbmc_parse_options.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,8 @@ void jbmc_parse_optionst::process_goto_function(
651651
remove_virtual_functions(function);
652652
// remove returns
653653
remove_returns(function);
654+
655+
replace_java_nondet(function);
654656
}
655657

656658
catch(const char *e)
@@ -705,8 +707,6 @@ bool jbmc_parse_optionst::process_goto_functions(
705707
? std::stoul(cmdline.get_value("java-max-input-tree-depth"))
706708
: MAX_NONDET_TREE_DEPTH;
707709

708-
replace_java_nondet(goto_model);
709-
710710
convert_nondet(
711711
goto_model,
712712
get_message_handler(),

0 commit comments

Comments
 (0)