9
9
#include " java_object_factory.h"
10
10
11
11
#include < util/expr_initializer.h>
12
- #include < util/fresh_symbol.h>
13
12
#include < util/nondet_bool.h>
14
13
#include < util/pointer_offset_size.h>
15
14
18
17
19
18
#include " generic_parameter_specialization_map_keys.h"
20
19
#include " java_root_class.h"
20
+ #include " java_utils.h"
21
21
22
22
class java_object_factoryt
23
23
{
@@ -206,13 +206,8 @@ exprt allocate_dynamic_object(
206
206
// create a symbol for the malloc expression so we can initialize
207
207
// without having to do it potentially through a double-deref, which
208
208
// breaks the to-SSA phase.
209
- symbolt &malloc_sym = get_fresh_aux_symbol (
210
- pointer_type (allocate_type),
211
- id2string (function_id),
212
- " malloc_site" ,
213
- loc,
214
- ID_java,
215
- symbol_table);
209
+ symbolt &malloc_sym = fresh_java_symbol (
210
+ pointer_type (allocate_type), " malloc_site" , loc, symbol_table);
216
211
symbols_created.push_back (&malloc_sym);
217
212
code_assignt assign (malloc_sym.symbol_expr (), malloc_expr);
218
213
assign.add_source_location ()=loc;
@@ -306,13 +301,8 @@ exprt java_object_factoryt::allocate_object(
306
301
case allocation_typet::LOCAL:
307
302
case allocation_typet::GLOBAL:
308
303
{
309
- symbolt &aux_symbol = get_fresh_aux_symbol (
310
- allocate_type,
311
- id2string (object_factory_parameters.function_id ),
312
- " tmp_object_factory" ,
313
- loc,
314
- ID_java,
315
- symbol_table);
304
+ symbolt &aux_symbol = fresh_java_symbol (
305
+ allocate_type, " tmp_object_factory" , loc, symbol_table);
316
306
if (alloc_type==allocation_typet::GLOBAL)
317
307
aux_symbol.is_static_lifetime =true ;
318
308
symbols_created.push_back (&aux_symbol);
@@ -622,13 +612,8 @@ bool initialize_nondet_string_fields(
622
612
623
613
// / \todo Refactor with make_nondet_string_expr
624
614
// length_expr = nondet(int);
625
- const symbolt length_sym = get_fresh_aux_symbol (
626
- java_int_type (),
627
- id2string (function_id),
628
- " tmp_object_factory" ,
629
- loc,
630
- ID_java,
631
- symbol_table);
615
+ const symbolt length_sym =
616
+ fresh_java_symbol (java_int_type (), " tmp_object_factory" , loc, symbol_table);
632
617
const symbol_exprt length_expr = length_sym.symbol_expr ();
633
618
const side_effect_expr_nondett nondet_length (length_expr.type (), loc);
634
619
code.add (code_declt (length_expr));
@@ -652,8 +637,8 @@ bool initialize_nondet_string_fields(
652
637
const typet data_ptr_type = pointer_type (
653
638
array_typet (java_char_type (), infinity_exprt (java_int_type ())));
654
639
655
- symbolt &data_pointer_sym = get_fresh_aux_symbol (
656
- data_ptr_type, " " , " string_data_pointer" , loc, ID_java , symbol_table);
640
+ symbolt &data_pointer_sym =
641
+ fresh_java_symbol ( data_ptr_type, " string_data_pointer" , loc, symbol_table);
657
642
const auto data_pointer = data_pointer_sym.symbol_expr ();
658
643
code.add (code_declt (data_pointer));
659
644
@@ -948,13 +933,8 @@ symbol_exprt java_object_factoryt::gen_nondet_subtype_pointer_init(
948
933
size_t depth,
949
934
const source_locationt &location)
950
935
{
951
- symbolt new_symbol = get_fresh_aux_symbol (
952
- replacement_pointer,
953
- id2string (object_factory_parameters.function_id ),
954
- " tmp_object_factory" ,
955
- loc,
956
- ID_java,
957
- symbol_table);
936
+ symbolt new_symbol = fresh_java_symbol (
937
+ replacement_pointer, " tmp_object_factory" , location, symbol_table);
958
938
959
939
// Generate a new object into this new symbol
960
940
gen_nondet_init (
@@ -1272,13 +1252,8 @@ const symbol_exprt java_object_factoryt::gen_nondet_int_init(
1272
1252
{
1273
1253
PRECONDITION (min_value_expr.type () == max_value_expr.type ());
1274
1254
// Allocate a new symbol for the int
1275
- const symbolt &int_symbol = get_fresh_aux_symbol (
1276
- min_value_expr.type (),
1277
- id2string (object_factory_parameters.function_id ),
1278
- basename_prefix,
1279
- loc,
1280
- ID_java,
1281
- symbol_table);
1255
+ const symbolt &int_symbol = fresh_java_symbol (
1256
+ min_value_expr.type (), basename_prefix, loc, symbol_table);
1282
1257
symbols_created.push_back (&int_symbol);
1283
1258
const auto &int_symbol_expr = int_symbol.symbol_expr ();
1284
1259
@@ -1396,13 +1371,8 @@ void java_object_factoryt::gen_nondet_array_init(
1396
1371
1397
1372
// Interpose a new symbol, as the goto-symex stage can't handle array indexing
1398
1373
// via a cast.
1399
- symbolt &array_init_symbol = get_fresh_aux_symbol (
1400
- init_array_expr.type (),
1401
- id2string (object_factory_parameters.function_id ),
1402
- " array_data_init" ,
1403
- loc,
1404
- ID_java,
1405
- symbol_table);
1374
+ symbolt &array_init_symbol = fresh_java_symbol (
1375
+ init_array_expr.type (), " array_data_init" , loc, symbol_table);
1406
1376
symbols_created.push_back (&array_init_symbol);
1407
1377
const auto &array_init_symexpr=array_init_symbol.symbol_expr ();
1408
1378
code_assignt data_assign (array_init_symexpr, init_array_expr);
@@ -1411,13 +1381,8 @@ void java_object_factoryt::gen_nondet_array_init(
1411
1381
1412
1382
// Emit init loop for(array_init_iter=0; array_init_iter!=array.length;
1413
1383
// ++array_init_iter) init(array[array_init_iter]);
1414
- symbolt &counter = get_fresh_aux_symbol (
1415
- length_expr.type (),
1416
- id2string (object_factory_parameters.function_id ),
1417
- " array_init_iter" ,
1418
- loc,
1419
- ID_java,
1420
- symbol_table);
1384
+ symbolt &counter =
1385
+ fresh_java_symbol (length_expr.type (), " array_init_iter" , loc, symbol_table);
1421
1386
symbols_created.push_back (&counter);
1422
1387
exprt counter_expr=counter.symbol_expr ();
1423
1388
0 commit comments