diff --git a/src/java_bytecode/ci_lazy_methods.cpp b/src/java_bytecode/ci_lazy_methods.cpp index aedbf364d28..32344f24b2a 100644 --- a/src/java_bytecode/ci_lazy_methods.cpp +++ b/src/java_bytecode/ci_lazy_methods.cpp @@ -170,14 +170,15 @@ bool ci_lazy_methodst::operator()( << " callsites)" << eom; - for(const auto &callsite : virtual_callsites) + std::unordered_set unique_functions; + for(const code_function_callt *virtual_callsite : virtual_callsites) + unique_functions.insert(virtual_callsite->function()); + + for(const exprt &function : unique_functions) { // This will also create a stub if a virtual callsite has no targets. get_virtual_method_targets( - *callsite, - instantiated_classes, - method_worklist2, - symbol_table); + function, instantiated_classes, method_worklist2, symbol_table); } } while(any_new_methods); @@ -403,8 +404,8 @@ void ci_lazy_methodst::gather_virtual_callsites( /// Find possible callees, excluding types that are not known to be /// instantiated. -/// \param c: function call whose potential target functions should -/// be determined. +/// \param called_function: virtual function call whose concrete function calls +/// should be determined. /// \param instantiated_classes: set of classes that can be instantiated. Any /// potential callee not in this set will be ignored. /// \param symbol_table: global symbol table @@ -412,12 +413,11 @@ void ci_lazy_methodst::gather_virtual_callsites( /// taking `instantiated_classes` into account (virtual function overrides /// defined on classes that are not 'needed' are ignored) void ci_lazy_methodst::get_virtual_method_targets( - const code_function_callt &c, + const exprt &called_function, const std::set &instantiated_classes, std::vector &callable_methods, symbol_tablet &symbol_table) { - const auto &called_function=c.function(); PRECONDITION(called_function.id()==ID_virtual_function); const auto &call_class=called_function.get(ID_C_class); diff --git a/src/java_bytecode/ci_lazy_methods.h b/src/java_bytecode/ci_lazy_methods.h index d69eb57f89b..f78414c44be 100644 --- a/src/java_bytecode/ci_lazy_methods.h +++ b/src/java_bytecode/ci_lazy_methods.h @@ -134,7 +134,7 @@ class ci_lazy_methodst:public messaget std::vector &result); void get_virtual_method_targets( - const code_function_callt &c, + const exprt &called_function, const std::set &instantiated_classes, std::vector &callable_methods, symbol_tablet &symbol_table);