@@ -183,10 +183,19 @@ gen_clinit_eqexpr(const exprt &expr, const clinit_statest state)
183
183
// / \param symbol_table: symbol table
184
184
// / \param class_name: name of the class to generate clinit wrapper calls for
185
185
// / \param [out] init_body: appended with calls to clinit wrapper
186
+ // / \param nondet_static: true if nondet-static option was given
187
+ // / \param object_factory_parameters: object factory parameters used to populate
188
+ // / nondet-initialized globals and objects reachable from them (only needed
189
+ // / if nondet-static is true)
190
+ // / \param pointer_type_selector: used to choose concrete types for abstract-
191
+ // / typed globals and fields (only needed if nondet-static is true)
186
192
static void clinit_wrapper_do_recursive_calls (
187
193
const symbol_tablet &symbol_table,
188
194
const irep_idt &class_name,
189
- code_blockt &init_body)
195
+ code_blockt &init_body,
196
+ const bool nondet_static,
197
+ const object_factory_parameterst &object_factory_parameters,
198
+ const select_pointer_typet &pointer_type_selector)
190
199
{
191
200
const symbolt &class_symbol = symbol_table.lookup_ref (class_name);
192
201
for (const auto &base : to_class_type (class_symbol.type ).bases ())
@@ -315,9 +324,9 @@ static void create_clinit_wrapper_symbols(
315
324
" clinit wrapper" );
316
325
}
317
326
318
- // / Thread safe version of the static initialiser .
327
+ // / Thread safe version of the static initializer .
319
328
// /
320
- // / Produces the static initialiser wrapper body for the given function. This
329
+ // / Produces the static initializer wrapper body for the given function. This
321
330
// / static initializer implements (a simplification of) the algorithm defined
322
331
// / in Section 5.5 of the JVM Specs. This function, or wrapper, checks whether
323
332
// / static init has already taken place, calls the actual `<clinit>` method if
@@ -381,10 +390,19 @@ static void create_clinit_wrapper_symbols(
381
390
// / \param function_id: clinit wrapper function id (the wrapper_method_symbol
382
391
// / name created by `create_clinit_wrapper_symbols`)
383
392
// / \param symbol_table: global symbol table
384
- // / \return the body of the static initialiser wrapper
393
+ // / \param nondet_static: true if nondet-static option was given
394
+ // / \param object_factory_parameters: object factory parameters used to populate
395
+ // / nondet-initialized globals and objects reachable from them (only needed
396
+ // / if nondet-static is true)
397
+ // / \param pointer_type_selector: used to choose concrete types for abstract-
398
+ // / typed globals and fields (only needed if nondet-static is true)
399
+ // / \return the body of the static initializer wrapper
385
400
codet get_thread_safe_clinit_wrapper_body (
386
401
const irep_idt &function_id,
387
- symbol_table_baset &symbol_table)
402
+ symbol_table_baset &symbol_table,
403
+ const bool nondet_static,
404
+ const object_factory_parameterst &object_factory_parameters,
405
+ const select_pointer_typet &pointer_type_selector)
388
406
{
389
407
const symbolt &wrapper_method_symbol = symbol_table.lookup_ref (function_id);
390
408
irep_idt class_name = wrapper_method_symbol.type .get (ID_C_class);
@@ -535,7 +553,13 @@ codet get_thread_safe_clinit_wrapper_body(
535
553
//
536
554
{
537
555
code_blockt init_body;
538
- clinit_wrapper_do_recursive_calls (symbol_table, class_name, init_body);
556
+ clinit_wrapper_do_recursive_calls (
557
+ symbol_table,
558
+ class_name,
559
+ init_body,
560
+ nondet_static,
561
+ object_factory_parameters,
562
+ pointer_type_selector);
539
563
function_body.append (init_body);
540
564
}
541
565
@@ -556,15 +580,24 @@ codet get_thread_safe_clinit_wrapper_body(
556
580
return function_body;
557
581
}
558
582
559
- // / Produces the static initialiser wrapper body for the given function.
583
+ // / Produces the static initializer wrapper body for the given function.
560
584
// / Note: this version of the clinit wrapper is not thread safe.
561
585
// / \param function_id: clinit wrapper function id (the wrapper_method_symbol
562
586
// / name created by `create_clinit_wrapper_symbols`)
563
587
// / \param symbol_table: global symbol table
564
- // / \return the body of the static initialiser wrapper/
588
+ // / \param nondet_static: true if nondet-static option was given
589
+ // / \param object_factory_parameters: object factory parameters used to populate
590
+ // / nondet-initialized globals and objects reachable from them (only needed
591
+ // / if nondet-static is true)
592
+ // / \param pointer_type_selector: used to choose concrete types for abstract-
593
+ // / typed globals and fields (only needed if nondet-static is true)
594
+ // / \return the body of the static initializer wrapper
565
595
codet get_clinit_wrapper_body (
566
596
const irep_idt &function_id,
567
- symbol_table_baset &symbol_table)
597
+ symbol_table_baset &symbol_table,
598
+ const bool nondet_static,
599
+ const object_factory_parameterst &object_factory_parameters,
600
+ const select_pointer_typet &pointer_type_selector)
568
601
{
569
602
// Assume that class C extends class C' and implements interfaces
570
603
// I1, ..., In. We now create the following function (possibly recursively
@@ -608,7 +641,13 @@ codet get_clinit_wrapper_body(
608
641
code_assignt set_already_run (already_run_symbol.symbol_expr (), true_exprt ());
609
642
init_body.move_to_operands (set_already_run);
610
643
611
- clinit_wrapper_do_recursive_calls (symbol_table, class_name, init_body);
644
+ clinit_wrapper_do_recursive_calls (
645
+ symbol_table,
646
+ class_name,
647
+ init_body,
648
+ nondet_static,
649
+ object_factory_parameters,
650
+ pointer_type_selector);
612
651
613
652
wrapper_body.then_case () = init_body;
614
653
0 commit comments