Skip to content

Commit 4fa23b8

Browse files
author
svorenova
committed
Pass information to clinit_wrapper constructors
Pass parameters necessary to nondet-initialize variables
1 parent 30d1ade commit 4fa23b8

File tree

3 files changed

+45
-9
lines changed

3 files changed

+45
-9
lines changed

jbmc/src/java_bytecode/java_bytecode_language.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,9 +1035,18 @@ bool java_bytecode_languaget::convert_single_method(
10351035
case synthetic_method_typet::STATIC_INITIALIZER_WRAPPER:
10361036
if(threading_support)
10371037
symbol.value = get_thread_safe_clinit_wrapper_body(
1038-
function_id, symbol_table);
1038+
function_id,
1039+
symbol_table,
1040+
nondet_static,
1041+
object_factory_parameters,
1042+
get_pointer_type_selector());
10391043
else
1040-
symbol.value = get_clinit_wrapper_body(function_id, symbol_table);
1044+
symbol.value = get_clinit_wrapper_body(
1045+
function_id,
1046+
symbol_table,
1047+
nondet_static,
1048+
object_factory_parameters,
1049+
get_pointer_type_selector());
10411050
break;
10421051
case synthetic_method_typet::STUB_CLASS_STATIC_INITIALIZER:
10431052
symbol.value =

jbmc/src/java_bytecode/java_static_initializers.cpp

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ gen_clinit_eqexpr(const exprt &expr, const clinit_statest state)
186186
static void clinit_wrapper_do_recursive_calls(
187187
const symbol_tablet &symbol_table,
188188
const irep_idt &class_name,
189-
code_blockt &init_body)
189+
code_blockt &init_body,
190+
const bool nondet_static,
191+
const object_factory_parameterst &object_factory_parameters,
192+
const select_pointer_typet &pointer_type_selector)
190193
{
191194
const symbolt &class_symbol = symbol_table.lookup_ref(class_name);
192195
for(const auto &base : to_class_type(class_symbol.type).bases())
@@ -384,7 +387,10 @@ static void create_clinit_wrapper_symbols(
384387
/// \return the body of the static initialiser wrapper
385388
codet get_thread_safe_clinit_wrapper_body(
386389
const irep_idt &function_id,
387-
symbol_table_baset &symbol_table)
390+
symbol_table_baset &symbol_table,
391+
const bool nondet_static,
392+
const object_factory_parameterst &object_factory_parameters,
393+
const select_pointer_typet &pointer_type_selector)
388394
{
389395
const symbolt &wrapper_method_symbol = symbol_table.lookup_ref(function_id);
390396
irep_idt class_name = wrapper_method_symbol.type.get(ID_C_class);
@@ -535,7 +541,13 @@ codet get_thread_safe_clinit_wrapper_body(
535541
//
536542
{
537543
code_blockt init_body;
538-
clinit_wrapper_do_recursive_calls(symbol_table, class_name, init_body);
544+
clinit_wrapper_do_recursive_calls(
545+
symbol_table,
546+
class_name,
547+
init_body,
548+
nondet_static,
549+
object_factory_parameters,
550+
pointer_type_selector);
539551
function_body.append(init_body);
540552
}
541553

@@ -564,7 +576,10 @@ codet get_thread_safe_clinit_wrapper_body(
564576
/// \return the body of the static initialiser wrapper/
565577
codet get_clinit_wrapper_body(
566578
const irep_idt &function_id,
567-
symbol_table_baset &symbol_table)
579+
symbol_table_baset &symbol_table,
580+
const bool nondet_static,
581+
const object_factory_parameterst &object_factory_parameters,
582+
const select_pointer_typet &pointer_type_selector)
568583
{
569584
// Assume that class C extends class C' and implements interfaces
570585
// I1, ..., In. We now create the following function (possibly recursively
@@ -608,7 +623,13 @@ codet get_clinit_wrapper_body(
608623
code_assignt set_already_run(already_run_symbol.symbol_expr(), true_exprt());
609624
init_body.move_to_operands(set_already_run);
610625

611-
clinit_wrapper_do_recursive_calls(symbol_table, class_name, init_body);
626+
clinit_wrapper_do_recursive_calls(
627+
symbol_table,
628+
class_name,
629+
init_body,
630+
nondet_static,
631+
object_factory_parameters,
632+
pointer_type_selector);
612633

613634
wrapper_body.then_case() = init_body;
614635

jbmc/src/java_bytecode/java_static_initializers.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,17 @@ void create_static_initializer_wrappers(
2929

3030
codet get_thread_safe_clinit_wrapper_body(
3131
const irep_idt &function_id,
32-
symbol_table_baset &symbol_table);
32+
symbol_table_baset &symbol_table,
33+
const bool nondet_static,
34+
const object_factory_parameterst &object_factory_parameters,
35+
const select_pointer_typet &pointer_type_selector);
3336

3437
codet get_clinit_wrapper_body(
3538
const irep_idt &function_id,
36-
symbol_table_baset &symbol_table);
39+
symbol_table_baset &symbol_table,
40+
const bool nondet_static,
41+
const object_factory_parameterst &object_factory_parameters,
42+
const select_pointer_typet &pointer_type_selector);
3743

3844
class stub_global_initializer_factoryt
3945
{

0 commit comments

Comments
 (0)