@@ -26,7 +26,6 @@ Author: Daniel Kroening, kroening@kroening.com
26
26
#include " java_bytecode_convert_method_class.h"
27
27
#include " bytecode_info.h"
28
28
#include " java_types.h"
29
- #include " java_utils.h"
30
29
31
30
#include < limits>
32
31
#include < algorithm>
@@ -415,7 +414,7 @@ codet java_bytecode_convert_methodt::get_array_bounds_check(
415
414
const exprt &idx,
416
415
const source_locationt& original_sloc)
417
416
{
418
- constant_exprt intzero=as_number (0 , java_int_type ());
417
+ constant_exprt intzero=from_integer (0 , java_int_type ());
419
418
binary_relation_exprt gezero (idx, ID_ge, intzero);
420
419
const member_exprt length_field (arraystruct, " length" , java_int_type ());
421
420
binary_relation_exprt ltlength (idx, ID_lt, length_field);
@@ -937,7 +936,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
937
936
// The stack isn't modified.
938
937
// TODO: convert assertions to exceptions.
939
938
assert (op.size ()==1 && results.size ()==1 );
940
- binary_predicate_exprt check (op[0 ], " java_instanceof " , arg0);
939
+ binary_predicate_exprt check (op[0 ], ID_java_instanceof , arg0);
941
940
c=code_assertt (check);
942
941
c.add_source_location ().set_comment (" Dynamic cast check" );
943
942
c.add_source_location ().set_property_class (" bad-dynamic-cast" );
@@ -1011,12 +1010,10 @@ codet java_bytecode_convert_methodt::convert_instructions(
1011
1010
}
1012
1011
1013
1012
code_function_callt call;
1014
- source_locationt loc;
1015
- loc=i_it->source_location ;
1013
+ source_locationt loc=i_it->source_location ;
1016
1014
loc.set_function (method_id);
1017
- source_locationt &source_loc=loc;
1018
1015
1019
- call.add_source_location ()=source_loc ;
1016
+ call.add_source_location ()=loc ;
1020
1017
call.arguments ()=pop (parameters.size ());
1021
1018
1022
1019
// double-check a bit
@@ -1089,7 +1086,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1089
1086
call.function ()=symbol_exprt (arg0.get (ID_identifier), arg0.type ());
1090
1087
}
1091
1088
1092
- call.function ().add_source_location ()=source_loc ;
1089
+ call.function ().add_source_location ()=loc ;
1093
1090
c=call;
1094
1091
}
1095
1092
else if (statement==" return" )
@@ -1245,7 +1242,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1245
1242
irep_idt number=to_constant_expr (arg0).get_value ();
1246
1243
code_gotot code_goto (label (number));
1247
1244
c=code_goto;
1248
- results[0 ]=as_number (
1245
+ results[0 ]=from_integer (
1249
1246
std::next (i_it)->address ,
1250
1247
pointer_typet (void_typet (), 64 ));
1251
1248
}
@@ -1267,9 +1264,8 @@ codet java_bytecode_convert_methodt::convert_instructions(
1267
1264
branches.move_to_operands (g);
1268
1265
else
1269
1266
{
1270
- code_ifthenelset
1271
- branch;
1272
- auto address_ptr=as_number (
1267
+ code_ifthenelset branch;
1268
+ auto address_ptr=from_integer (
1273
1269
jsr_ret_targets[idx],
1274
1270
pointer_typet (void_typet (), 64 ));
1275
1271
branch.cond ()=equal_exprt (retvar, address_ptr);
@@ -1311,9 +1307,9 @@ codet java_bytecode_convert_methodt::convert_instructions(
1311
1307
}
1312
1308
else
1313
1309
{
1314
- const size_t value (arg0.get_unsigned_int (ID_value));
1310
+ const unsigned value (arg0.get_unsigned_int (ID_value));
1315
1311
const typet type=java_type_from_char (statement[0 ]);
1316
- results[0 ]=as_number (value, type);
1312
+ results[0 ]=from_integer (value, type);
1317
1313
}
1318
1314
}
1319
1315
else if (statement==patternt (" ?ipush" ))
@@ -1326,8 +1322,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1326
1322
irep_idt number=to_constant_expr (arg0).get_value ();
1327
1323
assert (op.size ()==2 && results.empty ());
1328
1324
1329
- code_ifthenelset
1330
- code_branch;
1325
+ code_ifthenelset code_branch;
1331
1326
const irep_idt cmp_op=get_if_cmp_operator (statement);
1332
1327
1333
1328
binary_relation_exprt condition (op[0 ], cmp_op, op[1 ]);
@@ -1360,8 +1355,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1360
1355
irep_idt number=to_constant_expr (arg0).get_value ();
1361
1356
assert (op.size ()==1 && results.empty ());
1362
1357
1363
- code_ifthenelset
1364
- code_branch;
1358
+ code_ifthenelset code_branch;
1365
1359
code_branch.cond ()=
1366
1360
binary_relation_exprt (op[0 ], id, gen_zero (op[0 ].type ()));
1367
1361
code_branch.cond ().add_source_location ()=i_it->source_location ;
@@ -1378,8 +1372,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1378
1372
{
1379
1373
irep_idt number=to_constant_expr (arg0).get_value ();
1380
1374
assert (op.size ()==1 && results.empty ());
1381
- code_ifthenelset
1382
- code_branch;
1375
+ code_ifthenelset code_branch;
1383
1376
const typecast_exprt lhs (op[0 ], pointer_typet (empty_typet ()));
1384
1377
const exprt rhs (gen_zero (lhs.type ()));
1385
1378
code_branch.cond ()=binary_relation_exprt (lhs, ID_notequal, rhs);
@@ -1393,8 +1386,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1393
1386
{
1394
1387
assert (op.size ()==1 && results.empty ());
1395
1388
irep_idt number=to_constant_expr (arg0).get_value ();
1396
- code_ifthenelset
1397
- code_branch;
1389
+ code_ifthenelset code_branch;
1398
1390
const typecast_exprt lhs (op[0 ], pointer_typet (empty_typet ()));
1399
1391
const exprt rhs (gen_zero (lhs.type ()));
1400
1392
code_branch.cond ()=binary_relation_exprt (lhs, ID_equal, rhs);
@@ -1506,7 +1498,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1506
1498
results[0 ]=
1507
1499
if_exprt (
1508
1500
binary_relation_exprt (op[0 ], ID_equal, op[1 ]),
1509
- gen_zero ( t),
1501
+ from_integer ( 0 , t),
1510
1502
greater);
1511
1503
}
1512
1504
else if (statement==patternt (" ?cmp?" ))
@@ -1637,11 +1629,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1637
1629
1638
1630
// set $assertionDisabled to false
1639
1631
if (field_name.find (" $assertionsDisabled" )!=std::string::npos)
1640
- {
1641
- exprt e;
1642
- e.make_false ();
1643
- c=code_assignt (symbol_expr, e);
1644
- }
1632
+ c=code_assignt (symbol_expr, false_exprt ());
1645
1633
}
1646
1634
else if (statement==" putfield" )
1647
1635
{
@@ -1721,7 +1709,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1721
1709
if (!disable_runtime_checks)
1722
1710
{
1723
1711
// TODO make this throw NegativeArrayIndexException instead.
1724
- constant_exprt intzero=as_number (0 , java_int_type ());
1712
+ constant_exprt intzero=from_integer (0 , java_int_type ());
1725
1713
binary_relation_exprt gezero (op[0 ], ID_ge, intzero);
1726
1714
code_assertt check (gezero);
1727
1715
check.add_source_location ().set_comment (" Array size < 0" );
@@ -1731,7 +1719,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1731
1719
}
1732
1720
if (max_array_length!=0 )
1733
1721
{
1734
- constant_exprt size_limit=as_number (max_array_length, java_int_type ());
1722
+ constant_exprt size_limit=from_integer (max_array_length, java_int_type ());
1735
1723
binary_relation_exprt le_max_size (op[0 ], ID_le, size_limit);
1736
1724
code_assumet assume_le_max_size (le_max_size);
1737
1725
c.move_to_operands (assume_le_max_size);
@@ -1750,7 +1738,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1750
1738
op=pop (dimension);
1751
1739
assert (results.size ()==1 );
1752
1740
1753
- const pointer_typet ref_type= pointer_typet (arg0.type ());
1741
+ const pointer_typet ref_type (arg0.type ());
1754
1742
1755
1743
side_effect_exprt java_new_array (ID_java_new_array, ref_type);
1756
1744
java_new_array.operands ()=op;
0 commit comments