cprover
|
#include "java_bytecode_language.h"
#include "select_pointer_type.h"
#include <util/irep.h>
#include <util/symbol.h>
Go to the source code of this file.
Classes | |
struct | main_function_resultt |
Macros | |
#define | JAVA_ENTRY_POINT_RETURN_SYMBOL "return'" |
#define | JAVA_ENTRY_POINT_EXCEPTION_SYMBOL "uncaught_exception'" |
Functions | |
bool | java_entry_point (class symbol_table_baset &symbol_table, const irep_idt &main_class, class message_handlert &message_handler, bool assume_init_pointers_not_null, bool assert_uncaught_exceptions, const object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, bool string_refinement_enabled) |
Given the symbol_table and the main_class to test, this function generates a new function __CPROVER__start that calls the method under tests. More... | |
irep_idt | get_java_class_literal_initializer_signature () |
Get the symbol name of java.lang.Class' initializer method. More... | |
main_function_resultt | get_main_symbol (const symbol_table_baset &symbol_table, const irep_idt &main_class, message_handlert &) |
Figures out the entry point of the code to verify. More... | |
bool | generate_java_start_function (const symbolt &symbol, class symbol_table_baset &symbol_table, class message_handlert &message_handler, bool assume_init_pointers_not_null, bool assert_uncaught_exceptions, const object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector) |
Generate a _start function for a specific function. More... | |
#define JAVA_ENTRY_POINT_EXCEPTION_SYMBOL "uncaught_exception'" |
Definition at line 20 of file java_entry_point.h.
Referenced by generate_java_start_function(), and java_record_outputs().
#define JAVA_ENTRY_POINT_RETURN_SYMBOL "return'" |
Definition at line 19 of file java_entry_point.h.
Referenced by generate_java_start_function(), and java_record_outputs().
bool generate_java_start_function | ( | const symbolt & | symbol, |
symbol_table_baset & | symbol_table, | ||
message_handlert & | message_handler, | ||
bool | assume_init_pointers_not_null, | ||
bool | assert_uncaught_exceptions, | ||
const object_factory_parameterst & | object_factory_parameters, | ||
const select_pointer_typet & | pointer_type_selector | ||
) |
Generate a _start function for a specific function.
See java_entry_point for more details.
symbol | The symbol representing the function to call |
symbol_table | Global symbol table |
message_handler | Where to write output to |
assume_init_pointers_not_null | When creating pointers, assume they always take a non-null value. |
max_nondet_array_length | The length of the arrays to create when filling them |
max_nondet_tree_depth | defines the maximum depth of the object tree (see java_entry_points documentation for details) |
pointer_type_selector | Logic for substituting types of pointers |
Definition at line 577 of file java_entry_point.cpp.
References symbol_table_baset::add(), exprt::add_source_location(), code_function_callt::arguments(), symbolt::base_name, exprt::copy_to_operands(), goto_functionst::entry_point(), messaget::eom(), messaget::error(), code_function_callt::function(), code_labelt::get_label(), INITIALIZE_FUNCTION, symbol_table_baset::insert(), symbolt::is_static_lifetime, java_build_arguments(), java_bytecode_instrument_uncaught_exceptions(), JAVA_ENTRY_POINT_EXCEPTION_SYMBOL, JAVA_ENTRY_POINT_RETURN_SYMBOL, java_record_outputs(), java_reference_type(), code_function_callt::lhs(), loc, symbolt::location, irept::make_nil(), message_handler, symbolt::mode, exprt::move_to_operands(), symbolt::name, code_typet::return_type(), irept::swap(), symbolt::symbol_expr(), symbol_table_baset::symbols, to_code_type(), to_pointer_type(), symbolt::type, and symbolt::value.
Referenced by java_entry_point().
irep_idt get_java_class_literal_initializer_signature | ( | ) |
Get the symbol name of java.lang.Class' initializer method.
This method should initialize a Class instance with known properties of the type it represents, such as its name, whether it is abstract, or an enumeration, etc. The method may or may not exist in any particular symbol table; it is up to the caller to check. The method's Java signature is: void cproverInitializeClassLiteral( String name, boolean isAnnotation, boolean isArray, boolean isInterface, boolean isSynthetic, boolean isLocalClass, boolean isMemberClass, boolean isEnum);
Definition at line 88 of file java_entry_point.cpp.
Referenced by ci_lazy_methodst::convert_and_analyze_method(), and get_class_literal_initializer().
main_function_resultt get_main_symbol | ( | const symbol_table_baset & | symbol_table, |
const irep_idt & | main_class, | ||
message_handlert & | |||
) |
Figures out the entry point of the code to verify.
Definition at line 425 of file java_entry_point.cpp.
References config, dstringt::empty(), messaget::eom(), main_function_resultt::Error, messaget::error(), id2string(), INVARIANT, is_java_main(), JAVA_MAIN_METHOD, symbol_table_baset::lookup(), configt::main, message_handler, main_function_resultt::NotFound, and resolve_friendly_method_name().
Referenced by ci_lazy_methodst::entry_point_methods(), java_bytecode_languaget::generate_support_functions(), and java_entry_point().
bool java_entry_point | ( | symbol_table_baset & | symbol_table, |
const irep_idt & | main_class, | ||
message_handlert & | message_handler, | ||
bool | assume_init_pointers_not_null, | ||
bool | assert_uncaught_exceptions, | ||
const object_factory_parameterst & | object_factory_parameters, | ||
const select_pointer_typet & | pointer_type_selector, | ||
bool | string_refinement_enabled | ||
) |
Given the symbol_table
and the main_class
to test, this function generates a new function __CPROVER__start that calls the method under tests.
If __CPROVER__start is already in the symbol_table
, it silently returns. Otherwise it finds the method under test using get_main_symbol
and constructs a body for __CPROVER__start which does as follows:
java_record_outputs
)When assume_init_pointers_not_null
is false, the generated parameter initialization code will non-deterministically set input parameters to either null or a stack-allocated object. Observe that the null/non-null setting only applies to the parameter itself, and is not propagated to other pointers that it might be necessary to initialize in the object tree rooted at the parameter. Parameter max_nondet_array_length
provides the maximum length for an array used as part of the input to the method under test, and max_nondet_tree_depth
defines the maximum depth of the object tree created for such inputs. This maximum depth is used in conjunction with the so-called "recursive type set" (see field recursive_set
in class java_object_factoryt) to bound the depth of the object tree for the parameter. Only when
Definition at line 519 of file java_entry_point.cpp.
References create_initialize(), goto_functionst::entry_point(), generate_java_start_function(), get_main_symbol(), irept::id(), main_function_resultt::is_success(), java_static_lifetime_init(), symbolt::location, main_function_resultt::main_function, message_handler, symbol_table_baset::symbols, and symbolt::type.
Referenced by java_bytecode_languaget::generate_support_functions().