@@ -1590,25 +1590,11 @@ codet java_bytecode_convert_methodt::convert_instructions(
15901590 irep_idt ();
15911591
15921592 INVARIANT (!id.empty (), " unexpected bytecode-if" );
1593-
15941593 PRECONDITION (op.size () == 1 && results.empty ());
15951594 mp_integer number;
15961595 bool ret=to_integer (to_constant_expr (arg0), number);
15971596 INVARIANT (!ret, " if?? argument should be an integer" );
1598-
1599- code_ifthenelset code_branch;
1600- code_branch.cond ()=
1601- binary_relation_exprt (op[0 ], id, from_integer (0 , op[0 ].type ()));
1602- code_branch.cond ().add_source_location ()=i_it->source_location ;
1603- code_branch.cond ().add_source_location ().set_function (method_id);
1604- code_branch.then_case ()=code_gotot (label (integer2string (number)));
1605- code_branch.then_case ().add_source_location ()=
1606- address_map.at (integer2unsigned (number)).source ->source_location ;
1607- code_branch.then_case ().add_source_location ().set_function (method_id);
1608- code_branch.add_source_location ()=i_it->source_location ;
1609- code_branch.add_source_location ().set_function (method_id);
1610-
1611- c=code_branch;
1597+ c = convert_if (address_map, op, id, number, i_it->source_location );
16121598 }
16131599 else if (statement==patternt (" ifnonnull" ))
16141600 {
@@ -2575,6 +2561,27 @@ codet java_bytecode_convert_methodt::convert_instructions(
25752561 return code;
25762562}
25772563
2564+ codet java_bytecode_convert_methodt::convert_if (
2565+ const java_bytecode_convert_methodt::address_mapt &address_map,
2566+ const exprt::operandst &op,
2567+ const irep_idt &id,
2568+ const mp_integer &number,
2569+ const source_locationt &location) const
2570+ {
2571+ code_ifthenelset code_branch;
2572+ code_branch.cond () =
2573+ binary_relation_exprt (op[0 ], id, from_integer (0 , op[0 ].type ()));
2574+ code_branch.cond ().add_source_location () = location;
2575+ code_branch.cond ().add_source_location ().set_function (method_id);
2576+ code_branch.then_case () = code_gotot (label (integer2string (number)));
2577+ code_branch.then_case ().add_source_location () =
2578+ address_map.at (integer2unsigned (number)).source ->source_location ;
2579+ code_branch.then_case ().add_source_location ().set_function (method_id);
2580+ code_branch.add_source_location () = location;
2581+ code_branch.add_source_location ().set_function (method_id);
2582+ return code_branch;
2583+ }
2584+
25782585codet java_bytecode_convert_methodt::convert_if_cmp (
25792586 const java_bytecode_convert_methodt::address_mapt &address_map,
25802587 const irep_idt &statement,
0 commit comments