@@ -1590,25 +1590,11 @@ codet java_bytecode_convert_methodt::convert_instructions(
1590
1590
irep_idt ();
1591
1591
1592
1592
INVARIANT (!id.empty (), " unexpected bytecode-if" );
1593
-
1594
1593
PRECONDITION (op.size () == 1 && results.empty ());
1595
1594
mp_integer number;
1596
1595
bool ret=to_integer (to_constant_expr (arg0), number);
1597
1596
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 );
1612
1598
}
1613
1599
else if (statement==patternt (" ifnonnull" ))
1614
1600
{
@@ -2575,6 +2561,27 @@ codet java_bytecode_convert_methodt::convert_instructions(
2575
2561
return code;
2576
2562
}
2577
2563
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
+
2578
2585
codet java_bytecode_convert_methodt::convert_if_cmp (
2579
2586
const java_bytecode_convert_methodt::address_mapt &address_map,
2580
2587
const irep_idt &statement,
0 commit comments