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