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
{
@@ -179,13 +179,8 @@ exprt allocate_dynamic_object(
179
179
// create a symbol for the malloc expression so we can initialize
180
180
// without having to do it potentially through a double-deref, which
181
181
// breaks the to-SSA phase.
182
- symbolt &malloc_sym = get_fresh_aux_symbol (
183
- pointer_type (allocate_type),
184
- id2string (function_id),
185
- " malloc_site" ,
186
- loc,
187
- ID_java,
188
- symbol_table);
182
+ symbolt &malloc_sym = fresh_java_symbol (
183
+ pointer_type (allocate_type), " malloc_site" , loc, symbol_table);
189
184
symbols_created.push_back (&malloc_sym);
190
185
code_assignt assign=code_assignt (malloc_sym.symbol_expr (), malloc_expr);
191
186
assign.add_source_location ()=loc;
@@ -277,13 +272,8 @@ exprt java_object_factoryt::allocate_object(
277
272
case allocation_typet::LOCAL:
278
273
case allocation_typet::GLOBAL:
279
274
{
280
- symbolt &aux_symbol = get_fresh_aux_symbol (
281
- allocate_type,
282
- id2string (object_factory_parameters.function_id ),
283
- " tmp_object_factory" ,
284
- loc,
285
- ID_java,
286
- symbol_table);
275
+ symbolt &aux_symbol = fresh_java_symbol (
276
+ allocate_type, " tmp_object_factory" , loc, symbol_table);
287
277
if (alloc_type==allocation_typet::GLOBAL)
288
278
aux_symbol.is_static_lifetime =true ;
289
279
symbols_created.push_back (&aux_symbol);
@@ -591,13 +581,8 @@ bool initialize_nondet_string_fields(
591
581
592
582
// / \todo Refactor with make_nondet_string_expr
593
583
// length_expr = nondet(int);
594
- const symbolt length_sym = get_fresh_aux_symbol (
595
- java_int_type (),
596
- id2string (function_id),
597
- " tmp_object_factory" ,
598
- loc,
599
- ID_java,
600
- symbol_table);
584
+ const symbolt length_sym =
585
+ fresh_java_symbol (java_int_type (), " tmp_object_factory" , loc, symbol_table);
601
586
const symbol_exprt length_expr = length_sym.symbol_expr ();
602
587
const side_effect_expr_nondett nondet_length (length_expr.type ());
603
588
code.add (code_declt (length_expr));
@@ -622,8 +607,8 @@ bool initialize_nondet_string_fields(
622
607
const typet data_ptr_type = pointer_type (
623
608
array_typet (java_char_type (), infinity_exprt (java_int_type ())));
624
609
625
- symbolt &data_pointer_sym = get_fresh_aux_symbol (
626
- data_ptr_type, " " , " string_data_pointer" , loc, ID_java , symbol_table);
610
+ symbolt &data_pointer_sym =
611
+ fresh_java_symbol ( data_ptr_type, " string_data_pointer" , loc, symbol_table);
627
612
const auto data_pointer = data_pointer_sym.symbol_expr ();
628
613
code.add (code_declt (data_pointer));
629
614
@@ -885,13 +870,8 @@ symbol_exprt java_object_factoryt::gen_nondet_subtype_pointer_init(
885
870
const pointer_typet &replacement_pointer,
886
871
size_t depth)
887
872
{
888
- symbolt new_symbol = get_fresh_aux_symbol (
889
- replacement_pointer,
890
- id2string (object_factory_parameters.function_id ),
891
- " tmp_object_factory" ,
892
- loc,
893
- ID_java,
894
- symbol_table);
873
+ symbolt new_symbol = fresh_java_symbol (
874
+ replacement_pointer, " tmp_object_factory" , loc, symbol_table);
895
875
896
876
// Generate a new object into this new symbol
897
877
gen_nondet_init (
@@ -1211,13 +1191,8 @@ void java_object_factoryt::allocate_nondet_length_array(
1211
1191
const exprt &max_length_expr,
1212
1192
const typet &element_type)
1213
1193
{
1214
- symbolt &length_sym = get_fresh_aux_symbol (
1215
- java_int_type (),
1216
- id2string (object_factory_parameters.function_id ),
1217
- " nondet_array_length" ,
1218
- loc,
1219
- ID_java,
1220
- symbol_table);
1194
+ symbolt &length_sym = fresh_java_symbol (
1195
+ java_int_type (), " nondet_array_length" , loc, symbol_table);
1221
1196
symbols_created.push_back (&length_sym);
1222
1197
const auto &length_sym_expr=length_sym.symbol_expr ();
1223
1198
@@ -1306,13 +1281,8 @@ void java_object_factoryt::gen_nondet_array_init(
1306
1281
1307
1282
// Interpose a new symbol, as the goto-symex stage can't handle array indexing
1308
1283
// via a cast.
1309
- symbolt &array_init_symbol = get_fresh_aux_symbol (
1310
- init_array_expr.type (),
1311
- id2string (object_factory_parameters.function_id ),
1312
- " array_data_init" ,
1313
- loc,
1314
- ID_java,
1315
- symbol_table);
1284
+ symbolt &array_init_symbol = fresh_java_symbol (
1285
+ init_array_expr.type (), " array_data_init" , loc, symbol_table);
1316
1286
symbols_created.push_back (&array_init_symbol);
1317
1287
const auto &array_init_symexpr=array_init_symbol.symbol_expr ();
1318
1288
codet data_assign=code_assignt (array_init_symexpr, init_array_expr);
@@ -1321,13 +1291,8 @@ void java_object_factoryt::gen_nondet_array_init(
1321
1291
1322
1292
// Emit init loop for(array_init_iter=0; array_init_iter!=array.length;
1323
1293
// ++array_init_iter) init(array[array_init_iter]);
1324
- symbolt &counter = get_fresh_aux_symbol (
1325
- length_expr.type (),
1326
- id2string (object_factory_parameters.function_id ),
1327
- " array_init_iter" ,
1328
- loc,
1329
- ID_java,
1330
- symbol_table);
1294
+ symbolt &counter =
1295
+ fresh_java_symbol (length_expr.type (), " array_init_iter" , loc, symbol_table);
1331
1296
symbols_created.push_back (&counter);
1332
1297
exprt counter_expr=counter.symbol_expr ();
1333
1298
0 commit comments