Go to the documentation of this file.
12 #ifndef CPROVER_JAVA_BYTECODE_GATHER_METHODS_LAZILY_H
13 #define CPROVER_JAVA_BYTECODE_GATHER_METHODS_LAZILY_H
20 #include <unordered_set>
47 typedef std::map<irep_idt, class_method_and_bytecodet>
mapt;
53 return map.count(method_id) != 0;
60 method_class_and_bytecode.
method_id, method_class_and_bytecode));
71 mapt::const_iterator
begin()
const
75 mapt::const_iterator
end()
const
82 const auto it =
map.find(method_id);
85 return std::cref(it->second);
89 typedef std::function<
93 typedef std::function<std::vector<irep_idt>(
const symbol_tablet &)>
118 const std::unordered_set<irep_idt> &entry_points,
124 std::unordered_set<class_method_descriptor_exprt, irep_hash> &result);
128 const std::unordered_set<irep_idt> &instantiated_classes,
129 std::unordered_set<irep_idt> &callable_methods,
138 const std::unordered_set<irep_idt> &instantiated_classes,
145 const irep_idt &component_method_name);
168 std::unordered_set<irep_idt> &methods_already_populated,
169 const bool class_initializer_already_seen,
172 std::unordered_set<irep_idt> &methods_to_convert_later,
173 std::unordered_set<irep_idt> &instantiated_classes,
174 std::unordered_set<class_method_descriptor_exprt, irep_hash>
175 &called_virtual_functions,
179 std::unordered_set<irep_idt> &methods_to_convert_later,
180 std::unordered_set<irep_idt> &instantiated_classes,
181 const std::unordered_set<class_method_descriptor_exprt, irep_hash>
186 #endif // CPROVER_JAVA_BYTECODE_GATHER_METHODS_LAZILY_H
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Pair of class id and methodt.
const java_bytecode_parse_treet::methodt & method
Non-graph-based representation of the class hierarchy.
void add(const irep_idt &class_id, const irep_idt &method_id, const java_bytecode_parse_treet::methodt &method)
const std::vector< load_extra_methodst > & lazy_methods_extra_entry_points
optionalt< std::reference_wrapper< const class_method_and_bytecodet > > opt_reft
opt_reft get(const irep_idt &method_id)
Base class for all expressions.
static irep_idt build_virtual_method_name(const irep_idt &class_name, const irep_idt &component_method_name)
std::vector< irep_idt > main_jar_classes
std::unordered_map< irep_idt, synthetic_method_typet > synthetic_methods_mapt
Maps method names on to a synthetic method kind.
std::function< bool(const irep_idt &function_id, ci_lazy_methods_neededt)> method_convertert
void add(const class_method_and_bytecodet &method_class_and_bytecode)
An expression describing a method on a class.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
class_hierarchyt class_hierarchy
bool class_initializer_seen
mapt::const_iterator end() const
const select_pointer_typet & pointer_type_selector
std::function< std::vector< irep_idt >const symbol_tablet &)> load_extra_methodst
bool handle_virtual_methods_with_no_callees(std::unordered_set< irep_idt > &methods_to_convert_later, std::unordered_set< irep_idt > &instantiated_classes, const std::unordered_set< class_method_descriptor_exprt, irep_hash > &virtual_functions, symbol_tablet &symbol_table)
Look for virtual callsites with no candidate targets.
void get_virtual_method_targets(const class_method_descriptor_exprt &called_function, const std::unordered_set< irep_idt > &instantiated_classes, std::unordered_set< irep_idt > &callable_methods, symbol_tablet &symbol_table)
Find possible callees, excluding types that are not known to be instantiated.
convert_method_resultt convert_and_analyze_method(const method_convertert &method_converter, std::unordered_set< irep_idt > &methods_already_populated, const bool class_initializer_already_seen, const irep_idt &method_name, symbol_tablet &symbol_table, std::unordered_set< irep_idt > &methods_to_convert_later, std::unordered_set< irep_idt > &instantiated_classes, std::unordered_set< class_method_descriptor_exprt, irep_hash > &called_virtual_functions, message_handlert &message_handler)
Convert a method, add it to the populated set, add needed methods to methods_to_convert_later and add...
std::map< irep_idt, class_method_and_bytecodet > mapt
java_class_loadert & java_class_loader
nonstd::optional< T > optionalt
void gather_needed_globals(const exprt &e, const symbol_tablet &symbol_table, symbol_tablet &needed)
See output.
Class responsible to load .class files.
bool contains_method(const irep_idt &method_id) const
const synthetic_methods_mapt & synthetic_methods
void gather_virtual_callsites(const exprt &e, std::unordered_set< class_method_descriptor_exprt, irep_hash > &result)
Get places where virtual functions are called.
bool operator()(symbol_tablet &symbol_table, method_bytecodet &method_bytecode, const method_convertert &method_converter, message_handlert &message_handler)
Uses a simple context-insensitive ('ci') analysis to determine which methods may be reachable from th...
ci_lazy_methodst(const symbol_tablet &symbol_table, const irep_idt &main_class, const std::vector< irep_idt > &main_jar_classes, const std::vector< load_extra_methodst > &lazy_methods_extra_entry_points, java_class_loadert &java_class_loader, const std::vector< irep_idt > &extra_instantiated_classes, const select_pointer_typet &pointer_type_selector, const synthetic_methods_mapt &synthetic_methods)
Constructor for lazy-method loading.
std::unordered_set< irep_idt > entry_point_methods(const symbol_tablet &symbol_table, message_handlert &message_handler)
Entry point methods are either:
mapt::const_iterator begin() const
const std::vector< irep_idt > & extra_instantiated_classes
void initialize_instantiated_classes(const std::unordered_set< irep_idt > &entry_points, const namespacet &ns, ci_lazy_methods_neededt &needed_lazy_methods)
Build up a list of methods whose type may be passed around reachable from the entry point.
irep_idt get_virtual_method_target(const std::unordered_set< irep_idt > &instantiated_classes, const irep_idt &call_basename, const irep_idt &classname, const symbol_tablet &symbol_table)
Find a virtual callee, if one is defined and the callee type is known to exist.