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