@@ -1610,16 +1610,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1610
1610
mp_integer number;
1611
1611
bool ret=to_integer (to_constant_expr (arg0), number);
1612
1612
INVARIANT (!ret, " ifnull argument should be an integer" );
1613
- code_ifthenelset code_branch;
1614
- const typecast_exprt lhs (op[0 ], java_reference_type (empty_typet ()));
1615
- const exprt rhs (null_pointer_exprt (to_pointer_type (lhs.type ())));
1616
- code_branch.cond ()=binary_relation_exprt (lhs, ID_equal, rhs);
1617
- code_branch.then_case ()=code_gotot (label (integer2string (number)));
1618
- code_branch.then_case ().add_source_location ()=
1619
- address_map.at (integer2unsigned (number)).source ->source_location ;
1620
- code_branch.add_source_location ()=i_it->source_location ;
1621
-
1622
- c=code_branch;
1613
+ c = convert_ifnull (address_map, op, number, i_it->source_location );
1623
1614
}
1624
1615
else if (statement==" iinc" )
1625
1616
{
@@ -2552,6 +2543,23 @@ codet java_bytecode_convert_methodt::convert_instructions(
2552
2543
return code;
2553
2544
}
2554
2545
2546
+ codet java_bytecode_convert_methodt::convert_ifnull (
2547
+ const java_bytecode_convert_methodt::address_mapt &address_map,
2548
+ const exprt::operandst &op,
2549
+ const mp_integer &number,
2550
+ const source_locationt &location) const
2551
+ {
2552
+ code_ifthenelset code_branch;
2553
+ const typecast_exprt lhs (op[0 ], java_reference_type (empty_typet ()));
2554
+ const exprt rhs (null_pointer_exprt (to_pointer_type (lhs.type ())));
2555
+ code_branch.cond () = binary_relation_exprt (lhs, ID_equal, rhs);
2556
+ code_branch.then_case () = code_gotot (label (integer2string (number)));
2557
+ code_branch.then_case ().add_source_location () =
2558
+ address_map.at (integer2unsigned (number)).source ->source_location ;
2559
+ code_branch.add_source_location () = location;
2560
+ return code_branch;
2561
+ }
2562
+
2555
2563
codet java_bytecode_convert_methodt::convert_ifnonull (
2556
2564
const java_bytecode_convert_methodt::address_mapt &address_map,
2557
2565
const exprt::operandst &op,
0 commit comments