@@ -69,6 +69,11 @@ void java_bytecode_languaget::get_language_options(const cmdlinet &cmd)
69
69
else
70
70
lazy_methods_mode=LAZY_METHODS_MODE_EAGER;
71
71
72
+ if (cmd.isset (" java-threading" ))
73
+ threading_support = true ;
74
+ else
75
+ threading_support = false ;
76
+
72
77
if (cmd.isset (" java-throw-runtime-exceptions" ))
73
78
{
74
79
throw_runtime_exceptions = true ;
@@ -701,7 +706,8 @@ bool java_bytecode_languaget::typecheck(
701
706
// For each class that will require a static initializer wrapper, create a
702
707
// function named package.classname::clinit_wrapper, and a corresponding
703
708
// global tracking whether it has run or not:
704
- create_static_initializer_wrappers (symbol_table, synthetic_methods);
709
+ create_static_initializer_wrappers (
710
+ symbol_table, synthetic_methods, threading_support);
705
711
706
712
// Now incrementally elaborate methods
707
713
// that are reachable from this entry point.
@@ -961,7 +967,11 @@ bool java_bytecode_languaget::convert_single_method(
961
967
switch (synthetic_method_it->second )
962
968
{
963
969
case synthetic_method_typet::STATIC_INITIALIZER_WRAPPER:
964
- symbol.value = get_clinit_wrapper_body (function_id, symbol_table);
970
+ if (threading_support)
971
+ symbol.value = get_thread_safe_clinit_wrapper_body (
972
+ function_id, symbol_table);
973
+ else
974
+ symbol.value = get_clinit_wrapper_body (function_id, symbol_table);
965
975
break ;
966
976
case synthetic_method_typet::STUB_CLASS_STATIC_INITIALIZER:
967
977
symbol.value =
0 commit comments