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
{
@@ -205,13 +205,8 @@ exprt allocate_dynamic_object(
205
205
// create a symbol for the malloc expression so we can initialize
206
206
// without having to do it potentially through a double-deref, which
207
207
// breaks the to-SSA phase.
208
- symbolt &malloc_sym = get_fresh_aux_symbol (
209
- pointer_type (allocate_type),
210
- id2string (function_id),
211
- " malloc_site" ,
212
- loc,
213
- ID_java,
214
- symbol_table);
208
+ symbolt &malloc_sym = fresh_java_symbol (
209
+ pointer_type (allocate_type), " malloc_site" , loc, symbol_table);
215
210
symbols_created.push_back (&malloc_sym);
216
211
code_assignt assign=code_assignt (malloc_sym.symbol_expr (), malloc_expr);
217
212
assign.add_source_location ()=loc;
@@ -303,13 +298,8 @@ exprt java_object_factoryt::allocate_object(
303
298
case allocation_typet::LOCAL:
304
299
case allocation_typet::GLOBAL:
305
300
{
306
- symbolt &aux_symbol = get_fresh_aux_symbol (
307
- allocate_type,
308
- id2string (object_factory_parameters.function_id ),
309
- " tmp_object_factory" ,
310
- loc,
311
- ID_java,
312
- symbol_table);
301
+ symbolt &aux_symbol = fresh_java_symbol (
302
+ allocate_type, " tmp_object_factory" , loc, symbol_table);
313
303
if (alloc_type==allocation_typet::GLOBAL)
314
304
aux_symbol.is_static_lifetime =true ;
315
305
symbols_created.push_back (&aux_symbol);
@@ -615,13 +605,8 @@ bool initialize_nondet_string_fields(
615
605
616
606
// / \todo Refactor with make_nondet_string_expr
617
607
// length_expr = nondet(int);
618
- const symbolt length_sym = get_fresh_aux_symbol (
619
- java_int_type (),
620
- id2string (function_id),
621
- " tmp_object_factory" ,
622
- loc,
623
- ID_java,
624
- symbol_table);
608
+ const symbolt length_sym =
609
+ fresh_java_symbol (java_int_type (), " tmp_object_factory" , loc, symbol_table);
625
610
const symbol_exprt length_expr = length_sym.symbol_expr ();
626
611
const side_effect_expr_nondett nondet_length (length_expr.type (), loc);
627
612
code.add (code_declt (length_expr));
@@ -646,8 +631,8 @@ bool initialize_nondet_string_fields(
646
631
const typet data_ptr_type = pointer_type (
647
632
array_typet (java_char_type (), infinity_exprt (java_int_type ())));
648
633
649
- symbolt &data_pointer_sym = get_fresh_aux_symbol (
650
- data_ptr_type, " " , " string_data_pointer" , loc, ID_java , symbol_table);
634
+ symbolt &data_pointer_sym =
635
+ fresh_java_symbol ( data_ptr_type, " string_data_pointer" , loc, symbol_table);
651
636
const auto data_pointer = data_pointer_sym.symbol_expr ();
652
637
code.add (code_declt (data_pointer));
653
638
@@ -939,13 +924,8 @@ symbol_exprt java_object_factoryt::gen_nondet_subtype_pointer_init(
939
924
size_t depth,
940
925
const source_locationt &location)
941
926
{
942
- symbolt new_symbol = get_fresh_aux_symbol (
943
- replacement_pointer,
944
- id2string (object_factory_parameters.function_id ),
945
- " tmp_object_factory" ,
946
- loc,
947
- ID_java,
948
- symbol_table);
927
+ symbolt new_symbol = fresh_java_symbol (
928
+ replacement_pointer, " tmp_object_factory" , location, symbol_table);
949
929
950
930
// Generate a new object into this new symbol
951
931
gen_nondet_init (
@@ -1260,13 +1240,8 @@ const symbol_exprt java_object_factoryt::gen_nondet_int_init(
1260
1240
{
1261
1241
PRECONDITION (min_value_expr.type () == max_value_expr.type ());
1262
1242
// Allocate a new symbol for the int
1263
- const symbolt &int_symbol = get_fresh_aux_symbol (
1264
- min_value_expr.type (),
1265
- id2string (object_factory_parameters.function_id ),
1266
- basename_prefix,
1267
- loc,
1268
- ID_java,
1269
- symbol_table);
1243
+ const symbolt &int_symbol = fresh_java_symbol (
1244
+ min_value_expr.type (), basename_prefix, loc, symbol_table);
1270
1245
symbols_created.push_back (&int_symbol);
1271
1246
const auto &int_symbol_expr = int_symbol.symbol_expr ();
1272
1247
@@ -1382,13 +1357,8 @@ void java_object_factoryt::gen_nondet_array_init(
1382
1357
1383
1358
// Interpose a new symbol, as the goto-symex stage can't handle array indexing
1384
1359
// via a cast.
1385
- symbolt &array_init_symbol = get_fresh_aux_symbol (
1386
- init_array_expr.type (),
1387
- id2string (object_factory_parameters.function_id ),
1388
- " array_data_init" ,
1389
- loc,
1390
- ID_java,
1391
- symbol_table);
1360
+ symbolt &array_init_symbol = fresh_java_symbol (
1361
+ init_array_expr.type (), " array_data_init" , loc, symbol_table);
1392
1362
symbols_created.push_back (&array_init_symbol);
1393
1363
const auto &array_init_symexpr=array_init_symbol.symbol_expr ();
1394
1364
codet data_assign=code_assignt (array_init_symexpr, init_array_expr);
@@ -1397,13 +1367,8 @@ void java_object_factoryt::gen_nondet_array_init(
1397
1367
1398
1368
// Emit init loop for(array_init_iter=0; array_init_iter!=array.length;
1399
1369
// ++array_init_iter) init(array[array_init_iter]);
1400
- symbolt &counter = get_fresh_aux_symbol (
1401
- length_expr.type (),
1402
- id2string (object_factory_parameters.function_id ),
1403
- " array_init_iter" ,
1404
- loc,
1405
- ID_java,
1406
- symbol_table);
1370
+ symbolt &counter =
1371
+ fresh_java_symbol (length_expr.type (), " array_init_iter" , loc, symbol_table);
1407
1372
symbols_created.push_back (&counter);
1408
1373
exprt counter_expr=counter.symbol_expr ();
1409
1374
0 commit comments