@@ -1034,18 +1034,11 @@ codet java_bytecode_convert_methodt::convert_instructions(
1034
1034
i_it->statement ==" invokespecial" ||
1035
1035
i_it->statement ==" invokeinterface" )
1036
1036
{
1037
- // find the corresponding try-catch blocks and add the handlers
1038
- // to the targets
1039
- for (const auto &exception_row : method.exception_table )
1040
- {
1041
- if (i_it->address >=exception_row.start_pc &&
1042
- i_it->address <exception_row.end_pc )
1043
- {
1044
- a_entry.first ->second .successors .push_back (
1045
- exception_row.handler_pc );
1046
- targets.insert (exception_row.handler_pc );
1047
- }
1048
- }
1037
+ const std::vector<unsigned int > handler =
1038
+ try_catch_handler (i_it->address , method.exception_table );
1039
+ std::list<unsigned int > &successors = a_entry.first ->second .successors ;
1040
+ successors.insert (successors.end (), handler.begin (), handler.end ());
1041
+ targets.insert (handler.begin (), handler.end ());
1049
1042
}
1050
1043
1051
1044
if (i_it->statement ==" goto" ||
@@ -2726,6 +2719,20 @@ codet java_bytecode_convert_methodt::convert_instructions(
2726
2719
return code;
2727
2720
}
2728
2721
2722
+ std::vector<unsigned > java_bytecode_convert_methodt::try_catch_handler (
2723
+ const unsigned int address,
2724
+ const java_bytecode_parse_treet::methodt::exception_tablet &exception_table)
2725
+ const
2726
+ {
2727
+ std::vector<unsigned > result;
2728
+ for (const auto &exception_row : exception_table)
2729
+ {
2730
+ if (address >= exception_row.start_pc && address < exception_row.end_pc )
2731
+ result.push_back (exception_row.handler_pc );
2732
+ }
2733
+ return result;
2734
+ }
2735
+
2729
2736
// / This uses a cut-down version of the logic in
2730
2737
// / java_bytecode_convert_methodt::convert to initialize symbols for the
2731
2738
// / parameters and update the parameters in the type of method_symbol with
0 commit comments