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);
@@ -617,13 +607,8 @@ bool initialize_nondet_string_fields(
617
607
618
608
// / \todo Refactor with make_nondet_string_expr
619
609
// length_expr = nondet(int);
620
- const symbolt length_sym = get_fresh_aux_symbol (
621
- java_int_type (),
622
- id2string (function_id),
623
- " tmp_object_factory" ,
624
- loc,
625
- ID_java,
626
- symbol_table);
610
+ const symbolt length_sym =
611
+ fresh_java_symbol (java_int_type (), " tmp_object_factory" , loc, symbol_table);
627
612
const symbol_exprt length_expr = length_sym.symbol_expr ();
628
613
const side_effect_expr_nondett nondet_length (length_expr.type (), loc);
629
614
code.add (code_declt (length_expr));
@@ -647,8 +632,8 @@ bool initialize_nondet_string_fields(
647
632
const typet data_ptr_type = pointer_type (
648
633
array_typet (java_char_type (), infinity_exprt (java_int_type ())));
649
634
650
- symbolt &data_pointer_sym = get_fresh_aux_symbol (
651
- data_ptr_type, " " , " string_data_pointer" , loc, ID_java , symbol_table);
635
+ symbolt &data_pointer_sym =
636
+ fresh_java_symbol ( data_ptr_type, " string_data_pointer" , loc, symbol_table);
652
637
const auto data_pointer = data_pointer_sym.symbol_expr ();
653
638
code.add (code_declt (data_pointer));
654
639
@@ -940,13 +925,8 @@ symbol_exprt java_object_factoryt::gen_nondet_subtype_pointer_init(
940
925
size_t depth,
941
926
const source_locationt &location)
942
927
{
943
- symbolt new_symbol = get_fresh_aux_symbol (
944
- replacement_pointer,
945
- id2string (object_factory_parameters.function_id ),
946
- " tmp_object_factory" ,
947
- loc,
948
- ID_java,
949
- symbol_table);
928
+ symbolt new_symbol = fresh_java_symbol (
929
+ replacement_pointer, " tmp_object_factory" , location, symbol_table);
950
930
951
931
// Generate a new object into this new symbol
952
932
gen_nondet_init (
@@ -1261,13 +1241,8 @@ const symbol_exprt java_object_factoryt::gen_nondet_int_init(
1261
1241
{
1262
1242
PRECONDITION (min_value_expr.type () == max_value_expr.type ());
1263
1243
// Allocate a new symbol for the int
1264
- const symbolt &int_symbol = get_fresh_aux_symbol (
1265
- min_value_expr.type (),
1266
- id2string (object_factory_parameters.function_id ),
1267
- basename_prefix,
1268
- loc,
1269
- ID_java,
1270
- symbol_table);
1244
+ const symbolt &int_symbol = fresh_java_symbol (
1245
+ min_value_expr.type (), basename_prefix, loc, symbol_table);
1271
1246
symbols_created.push_back (&int_symbol);
1272
1247
const auto &int_symbol_expr = int_symbol.symbol_expr ();
1273
1248
@@ -1383,13 +1358,8 @@ void java_object_factoryt::gen_nondet_array_init(
1383
1358
1384
1359
// Interpose a new symbol, as the goto-symex stage can't handle array indexing
1385
1360
// via a cast.
1386
- symbolt &array_init_symbol = get_fresh_aux_symbol (
1387
- init_array_expr.type (),
1388
- id2string (object_factory_parameters.function_id ),
1389
- " array_data_init" ,
1390
- loc,
1391
- ID_java,
1392
- symbol_table);
1361
+ symbolt &array_init_symbol = fresh_java_symbol (
1362
+ init_array_expr.type (), " array_data_init" , loc, symbol_table);
1393
1363
symbols_created.push_back (&array_init_symbol);
1394
1364
const auto &array_init_symexpr=array_init_symbol.symbol_expr ();
1395
1365
codet data_assign=code_assignt (array_init_symexpr, init_array_expr);
@@ -1398,13 +1368,8 @@ void java_object_factoryt::gen_nondet_array_init(
1398
1368
1399
1369
// Emit init loop for(array_init_iter=0; array_init_iter!=array.length;
1400
1370
// ++array_init_iter) init(array[array_init_iter]);
1401
- symbolt &counter = get_fresh_aux_symbol (
1402
- length_expr.type (),
1403
- id2string (object_factory_parameters.function_id ),
1404
- " array_init_iter" ,
1405
- loc,
1406
- ID_java,
1407
- symbol_table);
1371
+ symbolt &counter =
1372
+ fresh_java_symbol (length_expr.type (), " array_init_iter" , loc, symbol_table);
1408
1373
symbols_created.push_back (&counter);
1409
1374
exprt counter_expr=counter.symbol_expr ();
1410
1375
0 commit comments