@@ -1614,28 +1614,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1614
1614
}
1615
1615
else if (statement==" iinc" )
1616
1616
{
1617
- code_blockt block;
1618
- block.add_source_location ()=i_it->source_location ;
1619
- // search variable on stack
1620
- const exprt &locvar=variable (arg0, ' i' , i_it->address , NO_CAST);
1621
- save_stack_entries (
1622
- " stack_iinc" ,
1623
- java_int_type (),
1624
- block,
1625
- bytecode_write_typet::VARIABLE,
1626
- to_symbol_expr (locvar).get_identifier ());
1627
-
1628
- code_assignt code_assign;
1629
- code_assign.lhs ()=
1630
- variable (arg0, ' i' , i_it->address , NO_CAST);
1631
- exprt arg1_int_type=arg1;
1632
- if (arg1.type ()!=java_int_type ())
1633
- arg1_int_type.make_typecast (java_int_type ());
1634
- code_assign.rhs ()=plus_exprt (
1635
- variable (arg0, ' i' , i_it->address , CAST_AS_NEEDED),
1636
- arg1_int_type);
1637
- block.copy_to_operands (code_assign);
1638
- c=block;
1617
+ c = convert_iinc (arg0, arg1, i_it->source_location , i_it->address );
1639
1618
}
1640
1619
else if (statement==patternt (" ?xor" ))
1641
1620
{
@@ -2543,6 +2522,34 @@ codet java_bytecode_convert_methodt::convert_instructions(
2543
2522
return code;
2544
2523
}
2545
2524
2525
+ codet java_bytecode_convert_methodt::convert_iinc (
2526
+ const exprt &arg0,
2527
+ const exprt &arg1,
2528
+ const source_locationt &location,
2529
+ const unsigned address)
2530
+ {
2531
+ code_blockt block;
2532
+ block.add_source_location () = location;
2533
+ // search variable on stack
2534
+ const exprt &locvar = variable (arg0, ' i' , address, NO_CAST);
2535
+ save_stack_entries (
2536
+ " stack_iinc" ,
2537
+ java_int_type (),
2538
+ block,
2539
+ bytecode_write_typet::VARIABLE,
2540
+ to_symbol_expr (locvar).get_identifier ());
2541
+
2542
+ code_assignt code_assign;
2543
+ code_assign.lhs () = variable (arg0, ' i' , address, NO_CAST);
2544
+ exprt arg1_int_type = arg1;
2545
+ if (arg1.type () != java_int_type ())
2546
+ arg1_int_type.make_typecast (java_int_type ());
2547
+ code_assign.rhs () =
2548
+ plus_exprt (variable (arg0, ' i' , address, CAST_AS_NEEDED), arg1_int_type);
2549
+ block.copy_to_operands (code_assign);
2550
+ return block;
2551
+ }
2552
+
2546
2553
codet java_bytecode_convert_methodt::convert_ifnull (
2547
2554
const java_bytecode_convert_methodt::address_mapt &address_map,
2548
2555
const exprt::operandst &op,
0 commit comments