@@ -71,7 +71,7 @@ bool ci_lazy_methodst::operator()(
71
71
method_bytecodet &method_bytecode,
72
72
const method_convertert &method_converter)
73
73
{
74
- std::vector <irep_idt> methods_to_convert_later;
74
+ std::unordered_set <irep_idt> methods_to_convert_later;
75
75
76
76
main_function_resultt main_function =
77
77
get_main_symbol (symbol_table, main_class, get_message_handler ());
@@ -93,39 +93,33 @@ bool ci_lazy_methodst::operator()(
93
93
const irep_idt methodid =
94
94
" java::" + id2string (class_name) + " ." + id2string (method.name )
95
95
+ " :" + id2string (method.descriptor );
96
- methods_to_convert_later.push_back (methodid);
96
+ methods_to_convert_later.insert (methodid);
97
97
}
98
98
}
99
99
}
100
100
else
101
- methods_to_convert_later.push_back (main_function.main_function .name );
101
+ methods_to_convert_later.insert (main_function.main_function .name );
102
102
103
103
// Add any extra entry points specified; we should elaborate these in the
104
104
// same way as the main function.
105
105
std::vector<irep_idt> extra_entry_points=lazy_methods_extra_entry_points;
106
106
resolve_method_names (extra_entry_points, symbol_table);
107
107
methods_to_convert_later.insert (
108
- methods_to_convert_later.begin (),
109
- extra_entry_points.begin (),
110
- extra_entry_points.end ());
108
+ extra_entry_points.begin (), extra_entry_points.end ());
111
109
112
- std::set <irep_idt> instantiated_classes;
110
+ std::unordered_set <irep_idt> instantiated_classes;
113
111
114
112
{
115
- std::vector <irep_idt> initial_callable_methods;
113
+ std::unordered_set <irep_idt> initial_callable_methods;
116
114
ci_lazy_methods_neededt initial_lazy_methods (
117
- initial_callable_methods,
118
- instantiated_classes,
119
- symbol_table);
115
+ initial_callable_methods, instantiated_classes, symbol_table);
120
116
initialize_instantiated_classes (
121
117
methods_to_convert_later, namespacet (symbol_table), initial_lazy_methods);
122
118
methods_to_convert_later.insert (
123
- methods_to_convert_later.end (),
124
- initial_callable_methods.begin (),
125
- initial_callable_methods.end ());
119
+ initial_callable_methods.begin (), initial_callable_methods.end ());
126
120
}
127
121
128
- std::set <irep_idt> methods_already_populated;
122
+ std::unordered_set <irep_idt> methods_already_populated;
129
123
std::vector<const code_function_callt *> virtual_callsites;
130
124
131
125
bool any_new_methods = true ;
@@ -134,7 +128,7 @@ bool ci_lazy_methodst::operator()(
134
128
any_new_methods=false ;
135
129
while (!methods_to_convert_later.empty ())
136
130
{
137
- std::vector <irep_idt> methods_to_convert;
131
+ std::unordered_set <irep_idt> methods_to_convert;
138
132
std::swap (methods_to_convert, methods_to_convert_later);
139
133
for (const auto &mname : methods_to_convert)
140
134
{
@@ -274,7 +268,7 @@ void ci_lazy_methodst::resolve_method_names(
274
268
// / whose references may be passed, directly or indirectly, to any of the
275
269
// / functions in `entry_points`.
276
270
void ci_lazy_methodst::initialize_instantiated_classes (
277
- const std::vector <irep_idt> &entry_points,
271
+ const std::unordered_set <irep_idt> &entry_points,
278
272
const namespacet &ns,
279
273
ci_lazy_methods_neededt &needed_lazy_methods)
280
274
{
@@ -410,8 +404,8 @@ void ci_lazy_methodst::gather_virtual_callsites(
410
404
// / defined on classes that are not 'needed' are ignored)
411
405
void ci_lazy_methodst::get_virtual_method_targets (
412
406
const exprt &called_function,
413
- const std::set <irep_idt> &instantiated_classes,
414
- std::vector <irep_idt> &callable_methods,
407
+ const std::unordered_set <irep_idt> &instantiated_classes,
408
+ std::unordered_set <irep_idt> &callable_methods,
415
409
symbol_tablet &symbol_table)
416
410
{
417
411
PRECONDITION (called_function.id ()==ID_virtual_function);
@@ -433,7 +427,7 @@ void ci_lazy_methodst::get_virtual_method_targets(
433
427
const irep_idt method_name = get_virtual_method_target (
434
428
instantiated_classes, call_basename, class_name, symbol_table);
435
429
if (!method_name.empty ())
436
- callable_methods.push_back (method_name);
430
+ callable_methods.insert (method_name);
437
431
}
438
432
}
439
433
@@ -539,7 +533,7 @@ void ci_lazy_methodst::gather_field_types(
539
533
// / `call_basename` if found and `classname` is present in
540
534
// / `instantiated_classes`, or irep_idt() otherwise.
541
535
irep_idt ci_lazy_methodst::get_virtual_method_target (
542
- const std::set <irep_idt> &instantiated_classes,
536
+ const std::unordered_set <irep_idt> &instantiated_classes,
543
537
const irep_idt &call_basename,
544
538
const irep_idt &classname,
545
539
const symbol_tablet &symbol_table)
0 commit comments