@@ -112,6 +112,17 @@ static prefix_filtert get_context(const optionst &options)
112
112
return prefix_filtert (std::move (context_include), std::move (context_exclude));
113
113
}
114
114
115
+ std::unordered_multimap<irep_idt, symbolt> &
116
+ lazy_class_to_declared_symbols_mapt::get (const symbol_tablet &symbol_table)
117
+ {
118
+ if (!initialized)
119
+ {
120
+ map = class_to_declared_symbols (symbol_table);
121
+ initialized = true ;
122
+ }
123
+ return map;
124
+ }
125
+
115
126
// / Consume options that are java bytecode specific.
116
127
void java_bytecode_languaget::set_language_options (const optionst &options)
117
128
{
@@ -995,12 +1006,17 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion(
995
1006
symbol_table_buildert symbol_table_builder =
996
1007
symbol_table_buildert::wrap (symbol_table);
997
1008
1009
+ lazy_class_to_declared_symbols_mapt class_to_declared_symbols;
1010
+
998
1011
const method_convertert method_converter =
999
- [this , &symbol_table_builder](
1012
+ [this , &symbol_table_builder, &class_to_declared_symbols ](
1000
1013
const irep_idt &function_id,
1001
1014
ci_lazy_methods_neededt lazy_methods_needed) {
1002
1015
return convert_single_method (
1003
- function_id, symbol_table_builder, std::move (lazy_methods_needed));
1016
+ function_id,
1017
+ symbol_table_builder,
1018
+ std::move (lazy_methods_needed),
1019
+ class_to_declared_symbols);
1004
1020
};
1005
1021
1006
1022
ci_lazy_methodst method_gather (
@@ -1134,7 +1150,8 @@ static void notify_static_method_calls(
1134
1150
bool java_bytecode_languaget::convert_single_method (
1135
1151
const irep_idt &function_id,
1136
1152
symbol_table_baset &symbol_table,
1137
- optionalt<ci_lazy_methods_neededt> needed_lazy_methods)
1153
+ optionalt<ci_lazy_methods_neededt> needed_lazy_methods,
1154
+ lazy_class_to_declared_symbols_mapt &class_to_declared_symbols)
1138
1155
{
1139
1156
// Do not convert if method is not in context
1140
1157
if (method_in_context && !(*method_in_context)(id2string (function_id)))
@@ -1212,16 +1229,14 @@ bool java_bytecode_languaget::convert_single_method(
1212
1229
class_name, " user_specified_clinit must be declared by a class." );
1213
1230
INVARIANT (
1214
1231
static_values_json.has_value (), " static-values JSON must be available" );
1215
- const auto class_to_declared_symbols_map =
1216
- class_to_declared_symbols (symbol_table);
1217
1232
writable_symbol.value = get_user_specified_clinit_body (
1218
1233
*class_name,
1219
1234
*static_values_json,
1220
1235
symbol_table,
1221
1236
needed_lazy_methods,
1222
1237
max_user_array_length,
1223
1238
references,
1224
- class_to_declared_symbols_map );
1239
+ class_to_declared_symbols. get (symbol_table) );
1225
1240
break ;
1226
1241
}
1227
1242
case synthetic_method_typet::STUB_CLASS_STATIC_INITIALIZER:
0 commit comments