@@ -1091,17 +1091,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
10911091 ret_instructions.push_back (i_it);
10921092 }
10931093 }
1094-
1095- // Draw edges from every `ret` to every `jsr` successor. Could do better with
1096- // flow analysis to distinguish multiple subroutines within the same function.
1097- for (const auto retinst : ret_instructions)
1098- {
1099- auto &a_entry=address_map.at (retinst->address );
1100- a_entry.successors .insert (
1101- a_entry.successors .end (),
1102- jsr_ret_targets.begin (),
1103- jsr_ret_targets.end ());
1104- }
1094+ draw_edges_from_ret_to_jsr (address_map, jsr_ret_targets, ret_instructions);
11051095
11061096 for (const auto &address : address_map)
11071097 {
@@ -2719,6 +2709,22 @@ codet java_bytecode_convert_methodt::convert_instructions(
27192709 return code;
27202710}
27212711
2712+ void java_bytecode_convert_methodt::draw_edges_from_ret_to_jsr (
2713+ java_bytecode_convert_methodt::address_mapt &address_map,
2714+ const std::vector<unsigned int > &jsr_ret_targets,
2715+ const std::vector<
2716+ std::vector<java_bytecode_parse_treet::instructiont>::const_iterator>
2717+ &ret_instructions) const
2718+ { // Draw edges from every `ret` to every `jsr` successor. Could do better with
2719+ // flow analysis to distinguish multiple subroutines within the same function.
2720+ for (const auto &retinst : ret_instructions)
2721+ {
2722+ auto &a_entry = address_map.at (retinst->address );
2723+ a_entry.successors .insert (
2724+ a_entry.successors .end (), jsr_ret_targets.begin (), jsr_ret_targets.end ());
2725+ }
2726+ }
2727+
27222728std::vector<unsigned > java_bytecode_convert_methodt::try_catch_handler (
27232729 const unsigned int address,
27242730 const java_bytecode_parse_treet::methodt::exception_tablet &exception_table)
0 commit comments