@@ -112,6 +112,23 @@ 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
+
126
+ void lazy_class_to_declared_symbols_mapt::reinitialize ()
127
+ {
128
+ initialized = false ;
129
+ map.clear ();
130
+ }
131
+
115
132
// / Consume options that are java bytecode specific.
116
133
void java_bytecode_languaget::set_language_options (const optionst &options)
117
134
{
@@ -995,12 +1012,17 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion(
995
1012
symbol_table_buildert symbol_table_builder =
996
1013
symbol_table_buildert::wrap (symbol_table);
997
1014
1015
+ lazy_class_to_declared_symbols_mapt class_to_declared_symbols;
1016
+
998
1017
const method_convertert method_converter =
999
- [this , &symbol_table_builder](
1018
+ [this , &symbol_table_builder, &class_to_declared_symbols ](
1000
1019
const irep_idt &function_id,
1001
1020
ci_lazy_methods_neededt lazy_methods_needed) {
1002
1021
return convert_single_method (
1003
- function_id, symbol_table_builder, std::move (lazy_methods_needed));
1022
+ function_id,
1023
+ symbol_table_builder,
1024
+ std::move (lazy_methods_needed),
1025
+ class_to_declared_symbols);
1004
1026
};
1005
1027
1006
1028
ci_lazy_methodst method_gather (
@@ -1134,7 +1156,8 @@ static void notify_static_method_calls(
1134
1156
bool java_bytecode_languaget::convert_single_method (
1135
1157
const irep_idt &function_id,
1136
1158
symbol_table_baset &symbol_table,
1137
- optionalt<ci_lazy_methods_neededt> needed_lazy_methods)
1159
+ optionalt<ci_lazy_methods_neededt> needed_lazy_methods,
1160
+ lazy_class_to_declared_symbols_mapt &class_to_declared_symbols)
1138
1161
{
1139
1162
// Do not convert if method is not in context
1140
1163
if (method_in_context && !(*method_in_context)(id2string (function_id)))
@@ -1212,16 +1235,14 @@ bool java_bytecode_languaget::convert_single_method(
1212
1235
class_name, " user_specified_clinit must be declared by a class." );
1213
1236
INVARIANT (
1214
1237
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
1238
writable_symbol.value = get_user_specified_clinit_body (
1218
1239
*class_name,
1219
1240
*static_values_json,
1220
1241
symbol_table,
1221
1242
needed_lazy_methods,
1222
1243
max_user_array_length,
1223
1244
references,
1224
- class_to_declared_symbols_map );
1245
+ class_to_declared_symbols. get (symbol_table) );
1225
1246
break ;
1226
1247
}
1227
1248
case synthetic_method_typet::STUB_CLASS_STATIC_INITIALIZER:
0 commit comments