@@ -1610,16 +1610,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
16101610 mp_integer number;
16111611 bool ret=to_integer (to_constant_expr (arg0), number);
16121612 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 );
16231614 }
16241615 else if (statement==" iinc" )
16251616 {
@@ -2552,6 +2543,23 @@ codet java_bytecode_convert_methodt::convert_instructions(
25522543 return code;
25532544}
25542545
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+
25552563codet java_bytecode_convert_methodt::convert_ifnonull (
25562564 const java_bytecode_convert_methodt::address_mapt &address_map,
25572565 const exprt::operandst &op,
0 commit comments