71 for(std::size_t i=0; i<parameters.size(); ++i)
75 if(i==0 && parameters[i].get_this())
78 base_name=
"stub_ignored_arg"+std::to_string(i);
81 parameters[i].set_base_name(base_name);
82 parameters[i].set_identifier(identifier);
106 symbol.base_name = base_name;
107 symbol.pretty_name = pretty_name;
114 log.
debug() <<
"Generating codet: new opaque symbol: method '" << symbol.name
116 symbol_table.
add(symbol);
134 for(std::size_t i=0; i<
n; i++)
153 for(std::size_t i=0; i<o.size(); i++)
164 const std::string &prefix,
219 return std::move(result);
230 const std::string &descriptor,
232 const std::string &class_name,
250 "Must be code type");
251 if(signature.has_value())
260 "Must be code type");
270 <<
"\n signature: " << signature.value()
271 <<
"\n descriptor: " << descriptor
272 <<
"\n different number of parameters, reverting to "
280 <<
"\n could not parse signature: " << signature.value()
281 <<
"\n " << e.what() <<
"\n"
282 <<
" reverting to descriptor: " << descriptor
346 parameters.insert(parameters.begin(),
this_p);
356 method_symbol.pretty_name=
397 symbol_table.
add(method_symbol);
402 new_method.set_base_name(method_symbol.base_name);
403 new_method.set_pretty_name(method_symbol.pretty_name);
434 if(v.index >= slots_for_parameters)
437 std::ostringstream
id_oss;
447 variables[v.index].emplace_back(result, v.start_pc, v.length);
454 std::size_t param_index = 0;
455 for(
const auto &
param : parameters)
458 variables[param_index].size() <= 1,
459 "should have at most one entry per index");
463 param_index == slots_for_parameters,
464 "java_parameter_count and local computation must agree");
466 for(
auto &
param : parameters)
475 if(param_index == 0 &&
param.get_this())
481 else if(!variables[param_index].empty())
484 base_name = variables[param_index][0].symbol_expr.get(
ID_C_base_name);
485 identifier = variables[param_index][0].symbol_expr.get(
ID_identifier);
493 base_name =
"arg" + std::to_string(param_index) + suffix;
496 param.set_base_name(base_name);
497 param.set_identifier(identifier);
503 param_index == slots_for_parameters,
504 "java_parameter_count and local computation must agree");
513 std::size_t param_index = 0;
514 for(
const auto &
param : parameters)
524 variables[param_index].
clear();
525 variables[param_index].emplace_back(
528 std::numeric_limits<size_t>::max(),
577 "Name of method symbol shouldn't change");
580 "Base name of method symbol shouldn't change");
582 method_symbol.module.empty(),
583 "Method symbol shouldn't have module");
607 "Member type should have already been marked as a constructor");
625 method_symbol.
value = std::move(code);
632 if(bytecode ==
patternt(
"if_?cmplt"))
634 if(bytecode ==
patternt(
"if_?cmple"))
636 if(bytecode ==
patternt(
"if_?cmpgt"))
638 if(bytecode ==
patternt(
"if_?cmpge"))
640 if(bytecode ==
patternt(
"if_?cmpeq"))
642 if(bytecode ==
patternt(
"if_?cmpne"))
645 throw "unhandled java comparison instruction";
657 const exprt &pointer,
679 components.size() != 0,
680 "infer_opaque_type_fields should guarantee that a member access has a "
681 "corresponding field");
700 const auto &
stmt=
repl.get_statement();
709 for(
auto &op :
repl.operands())
786 tree.branch_addresses.begin(),
787 tree.branch_addresses.end(),
798 tree.branch_addresses.begin(),
799 tree.branch_addresses.end(),
857 for(
auto p :
checkit->second.predecessors)
862 <<
"warning: refusing to create lexical block spanning "
864 <<
" due to incoming edge " << p <<
" -> " <<
checkit->first
884 log.
debug() <<
"Generating codet: combining "
927 newnode.branch_addresses.insert(
928 newnode.branch_addresses.begin(),
948 std::map<irep_idt, java_bytecode_convert_methodt::variablet> &result)
953 auto findit = result.emplace(
954 std::piecewise_construct,
955 std::forward_as_tuple(
symexpr.get_identifier()),
956 std::forward_as_tuple(
symexpr, pc, 1));
959 auto &var =
findit.first->second;
963 var.length+=(var.start_pc-pc);
968 var.length=std::max(var.length, (pc-var.start_pc)+1);
1014 std::size_t param_index =
method_type.has_this() ? 1 : 0;
1017 "parameters and parameter annotations mismatch");
1032 parameters[param_index].get_identifier();
1041 check_loc.set_comment(
"Not null annotation check");
1042 check_loc.set_property_class(
"not-null-annotation-check");
1067 std::set<method_offsett> targets;
1072 for(
auto i_it = instructions.begin();
i_it != instructions.end();
i_it++)
1075 std::pair<address_mapt::iterator, bool>
a_entry=
1076 address_map.insert(std::make_pair(
i_it->address,
ins));
1082 const auto bytecode =
i_it->bytecode;
1095 instructionst::const_iterator next=
i_it;
1096 if(++next!=instructions.end())
1097 a_entry.first->second.successors.push_back(next->address);
1121 const std::vector<method_offsett>
handler =
1123 std::list<method_offsett> &successors =
a_entry.first->second.successors;
1124 successors.insert(successors.end(),
handler.begin(),
handler.end());
1130 bytecode ==
patternt(
"if_?cmp??") ||
1141 targets.insert(target);
1143 a_entry.first->second.successors.push_back(target);
1147 auto next = std::next(
i_it);
1149 next != instructions.end(),
"jsr should have valid return address");
1150 targets.insert(next->address);
1157 for(
const auto &arg :
i_it->args)
1162 targets.insert(target);
1163 a_entry.first->second.successors.push_back(target);
1168 else if(bytecode ==
BC_ret)
1176 for(
const auto &address : address_map)
1178 for(
auto s : address.second.successors)
1180 const auto a_it = address_map.find(s);
1182 a_it->second.predecessors.insert(address.first);
1198 if(!instructions.empty())
1210 if(instruction.done)
1213 instruction.successors.begin(), instruction.successors.end());
1215 instructionst::const_iterator
i_it = instruction.source;
1216 stack.swap(instruction.stack);
1217 instruction.stack.clear();
1218 codet &
c = instruction.code;
1221 stack.empty() || instruction.predecessors.size() <= 1 ||
1223 "inconsistent stack");
1228 const auto bytecode =
i_it->bytecode;
1233 if(statement.size()>=2 &&
1234 statement[statement.size()-2]==
'_' &&
1235 isdigit(statement[statement.size()-1]))
1240 std::string(
id2string(statement), statement.size()-1, 1)),
1252 if(
cur_pc==it->handler_pc)
1255 catch_type !=
typet() ||
1262 catch_type=it->catch_type;
1268 if(catch_type!=
typet())
1320 "java::org.cprover.CProver.assume:(Z)V")
1325 "function expected to have exactly one parameter");
1351 "invokeinterface, invokespecial, invokevirtual and invokestatic should "
1352 "be called with a class method descriptor expression as arg0");
1362 else if(bytecode ==
patternt(
"?return"))
1371 else if(bytecode ==
patternt(
"?astore"))
1376 else if(bytecode ==
patternt(
"?store") || bytecode ==
patternt(
"?store_?"))
1381 statement,
arg0, op,
i_it->address,
i_it->source_location);
1383 else if(bytecode ==
patternt(
"?aload"))
1399 "String and Class literals should have been lowered in "
1400 "generate_constant_global_variables");
1422 std::next(
i_it)->address,
1426 else if(bytecode ==
BC_ret)
1441 else if(bytecode ==
patternt(
"?const_?"))
1446 else if(bytecode ==
patternt(
"?ipush"))
1450 arg0.is_constant(),
"ipush argument expected to be constant");
1453 else if(bytecode ==
patternt(
"if_?cmp??"))
1459 address_map, bytecode, op, number,
i_it->source_location);
1461 else if(bytecode ==
patternt(
"if??"))
1474 INVARIANT(!
id.empty(),
"unexpected bytecode-if");
1480 else if(bytecode ==
patternt(
"ifnonnull"))
1487 else if(bytecode ==
patternt(
"ifnull"))
1498 else if(bytecode ==
patternt(
"?xor"))
1503 else if(bytecode ==
patternt(
"?or"))
1508 else if(bytecode ==
patternt(
"?and"))
1513 else if(bytecode ==
patternt(
"?shl"))
1518 else if(bytecode ==
patternt(
"?shr"))
1523 else if(bytecode ==
patternt(
"?ushr"))
1528 else if(bytecode ==
patternt(
"?add"))
1533 else if(bytecode ==
patternt(
"?sub"))
1538 else if(bytecode ==
patternt(
"?div"))
1543 else if(bytecode ==
patternt(
"?mul"))
1548 else if(bytecode ==
patternt(
"?neg"))
1553 else if(bytecode ==
patternt(
"?rem"))
1563 else if(bytecode ==
patternt(
"?cmp"))
1568 else if(bytecode ==
patternt(
"?cmp?"))
1573 else if(bytecode ==
patternt(
"?cmpl"))
1578 else if(bytecode ==
BC_dup)
1626 field_name.find(
"$assertionsDisabled")!=std::string::npos;
1636 i_it->source_location,
1705 else if(bytecode ==
patternt(
"?2?"))
1720 else if(bytecode ==
BC_new)
1780 else if(bytecode ==
BC_nop)
1802 if(!
i_it->source_location.get_line().empty())
1807 instruction.done =
true;
1808 for(
const auto address : instruction.successors)
1810 address_mapt::iterator
a_it2=address_map.find(address);
1823 if(!
stack.empty() &&
a_it2->second.predecessors.size()>1)
1830 if(
a_it2->second.stack.empty())
1832 for(stackt::iterator
s_it=
stack.begin();
1847 "Stack sizes should be the same.");
1848 stackt::const_iterator
os_it=
a_it2->second.stack.begin();
1849 for(
auto &expr :
stack)
1853 "invalid base name");
1874 if(last_statement.get_statement()==
ID_goto)
1877 if(last_statement.get_statement() !=
ID_block)
1881 last_statement.operands().begin(),
1901 new_symbol.is_file_local=
true;
1902 new_symbol.is_thread_local=
true;
1903 new_symbol.is_lvalue=
true;
1954 "Block addresses should be unique and increasing");
1972 for(
const auto &
aentry : address_map)
1980 for(
const auto &v :
vlist)
2005 v.start_pc + v.length,
2006 std::numeric_limits<method_offsett>::max(),
2015 if(v.symbol_expr.get_identifier().empty())
2021 v.start_pc + v.length,
2022 std::numeric_limits<method_offsett>::max());
2024 block.statements().insert(block.statements().begin(), d);
2059 for(
auto a_it = args.begin();
a_it != args.end();
2075 if(
a_it == args.begin())
2104 const irep_idt descriptor = (statement ==
"monitorenter") ?
2105 "java::java.lang.Object.monitorenter:(Ljava/lang/Object;)V" :
2106 "java::java.lang.Object.monitorexit:(Ljava/lang/Object;)V";
2116 call.add_source_location() = source_location;
2119 return std::move(
call);
2178 if(is_double || is_float)
2188 value.from_integer(number);
2191 value.from_expr(
arg0);
2213 parameters.size() == arguments.size(),
2214 "for each parameter there must be exactly one argument");
2215 for(std::size_t i = 0; i < parameters.size(); i++)
2217 const typet &type = parameters[i].type();
2235 const bool use_this(statement !=
"invokestatic");
2236 const bool is_virtual(
2237 statement ==
"invokevirtual" || statement ==
"invokeinterface");
2242 "invoke statement arg0 must have an identifier");
2256 to_code_type(method_symbol->second.type).return_type().id(),
2257 "Function return type must not change in kind");
2272 if(parameters.empty() || !parameters[0].get_this())
2279 parameters.insert(parameters.begin(),
this_p);
2284 if(statement ==
"invokespecial")
2304 "first argument must be a pointer");
2373 std::move(lhs), std::move(function), std::move(arguments));
2374 call.add_source_location() = location;
2375 call.function().add_source_location() = location;
2400 c.add_source_location() = location;
2412 assert_class.add_source_location().set_comment(
"Dynamic cast check");
2413 assert_class.add_source_location().set_property_class(
"bad-dynamic-cast");
2469 typedef std::vector<std::reference_wrapper<
2475 if(exception.start_pc ==
cur_pc)
2488 exception_list.emplace_back(
2489 exception.catch_type.get_identifier(),
2492 label(std::to_string(exception.handler_pc)));
2574 if(statement ==
"newarray")
2638 c.add_source_location() = location;
2671 "stack_static_field",
2741 const int nan_value(statement[4] ==
'l' ? -1 : 1);
2906 code_branch.cond().add_source_location() = location;
2953 g.add_source_location() = location;
2964 branch.cond().add_source_location() = location;
2965 branch.add_source_location() = location;
2984 "java::array[boolean]") ||
3021 "iload can be used for boolean, byte, short, int and char");
3027 "Variable type must match [adflv]load return type");
3108 if(!value.has_value())
3161 std::vector<java_bytecode_parse_treet::instructiont>::const_iterator>
3173std::vector<java_bytecode_convert_methodt::method_offsett>
3179 std::vector<method_offsett> result;
3203 &local_variable_table,
3216 std::map<std::size_t, base_name_and_identifiert>
param_names;
3217 for(
const auto &v : local_variable_table)
3219 if(v.index < slots_for_parameters)
3227 std::size_t param_index = 0;
3228 for(
auto &
param : parameters)
3237 if(param_index == 0 &&
param.get_this())
3258 base_name =
"arg" + std::to_string(param_index) + suffix;
3263 param.set_base_name(base_name);
3264 param.set_identifier(identifier);
3283 size_t max_array_length,
3284 bool throw_assertion_error,
3288 bool threading_support,
3290 bool assert_no_exceptions_thrown)
3297 throw_assertion_error,
3298 needed_lazy_methods,
3302 assert_no_exceptions_thrown);
3314 const irep_idt &mangled_method_name)
const
3329 const irep_idt &component_name)
const
3352 const std::function<
bool(
3353 const std::function<
tvt(
const exprt &expr)>,
const exprt &expr)>
3355 const std::function<
tvt(
const exprt &expr)> predicate,
3356 const exprt &expr) {
3357 const tvt &
tvres = predicate(expr);
3358 if(
tvres.is_unknown())
3364 return entry_matches(predicate, expr);
3369 return tvres.is_true();
3377 const exprt &expr) {
3387 [&identifier](
const exprt &expr) {
3390 :
tvt(symbol_expr->get_identifier() == identifier);
3397 [](
const exprt &expr) {
3398 const auto dereference_expr =
API to expression classes for bitvectors.
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
const integer_bitvector_typet & to_integer_bitvector_type(const typet &type)
Cast a typet to an integer_bitvector_typet.
void branch(goto_modelt &goto_model, const irep_idt &id)
struct bytecode_infot const bytecode_info[]
#define BC_multianewarray
#define BC_invokeinterface
pointer_typet pointer_type(const typet &subtype)
virtual void clear()
Reset the abstract state.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Internally generated symbol table entryThis is a symbol generated as part of translation to or modifi...
A base class for binary expressions.
A base class for relations, i.e., binary predicates whose two operands have the same type.
Non-graph-based representation of the class hierarchy.
An expression describing a method on a class.
A non-fatal assertion, which checks a condition then permits execution to continue.
A goto_instruction_codet representing an assignment in the program.
An assumption, which must hold in subsequent code.
A codet representing sequential composition of program statements.
void append(const code_blockt &extra_block)
Add all the codets from extra_block to the current code_blockt.
void add(const codet &code)
A goto_instruction_codet representing the declaration of a local variable.
codet representation of an expression statement.
codet representation of a "return from a function" statement.
goto_instruction_codet representation of a function call statement.
exprt::operandst argumentst
codet representation of a goto statement.
codet representation of an if-then-else statement.
codet representation of a label for branch targets.
A statement that catches an exception, assigning the exception in flight to an expression (e....
Pops an exception handler from the stack of active handlers (i.e.
Pushes an exception handler, of the form: exception_tag1 -> label1 exception_tag2 -> label2 ....
std::vector< exception_list_entryt > exception_listt
A codet representing a skip statement.
codet representation of a switch-case, i.e. a case statement within a switch.
codet representing a switch statement.
Data structure for representing an arbitrary statement in a program.
A constant literal expression.
Operator to dereference a pointer.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
std::vector< exprt > operandst
typet & type()
Return the type of the expression.
source_locationt & add_source_location()
The Boolean constant false.
Represents the argument of an instruction that uses a CONSTANT_Fieldref This is used for example as a...
IEEE-floating-point equality.
static ieee_float_spect single_precision()
static ieee_float_spect double_precision()
The trinary if-then-else operator.
There are a large number of kinds of tree structured or tree-like data in CPROVER.
void set(const irep_idt &name, const irep_idt &value)
const irep_idt & id() const
Evaluates to true if the operand is NaN.
void convert_dup2_x2(exprt::operandst &op, exprt::operandst &results)
optionalt< ci_lazy_methods_neededt > needed_lazy_methods
method_offsett slots_for_parameters
Number of local variable slots used by the JVM to pass parameters upon invocation of the method under...
irep_idt get_static_field(const irep_idt &class_identifier, const irep_idt &component_name) const
Get static field identifier referred to by class_identifier.component_name Note this may be inherited...
void draw_edges_from_ret_to_jsr(address_mapt &address_map, const std::vector< method_offsett > &jsr_ret_targets, const std::vector< std::vector< java_bytecode_parse_treet::instructiont >::const_iterator > &ret_instructions) const
std::set< symbol_exprt > used_local_names
code_ifthenelset convert_if_cmp(const java_bytecode_convert_methodt::address_mapt &address_map, const u1 bytecode, const exprt::operandst &op, const mp_integer &number, const source_locationt &location) const
void create_stack_tmp_var(const std::string &, const typet &, code_blockt &, exprt &)
actually create a temporary variable to hold the value of a stack entry
codet & do_exception_handling(const methodt &method, const std::set< method_offsett > &working_set, method_offsett cur_pc, codet &c)
exprt::operandst & convert_ushr(const irep_idt &statement, const exprt::operandst &op, exprt::operandst &results) const
std::vector< variablet > variablest
exprt convert_load(const exprt &index, char type_char, size_t address)
Load reference from local variable.
void setup_local_variables(const methodt &m, const address_mapt &amap)
See find_initializers_for_slot above for more detail.
const variablet & find_variable_for_slot(size_t address, variablest &var_list)
See above.
void push(const exprt::operandst &o)
code_blockt convert_store(const irep_idt &statement, const exprt &arg0, const exprt::operandst &op, const method_offsett address, const source_locationt &location)
code_blockt convert_astore(const irep_idt &statement, const exprt::operandst &op, const source_locationt &location)
static irep_idt label(const irep_idt &address)
std::vector< method_offsett > try_catch_handler(method_offsett address, const java_bytecode_parse_treet::methodt::exception_tablet &exception_table) const
code_blockt convert_instructions(const methodt &)
codet & replace_call_to_cprover_assume(source_locationt location, codet &c)
java_string_library_preprocesst & string_preprocess
code_blockt convert_ret(const std::vector< method_offsett > &jsr_ret_targets, const exprt &arg0, const source_locationt &location, const method_offsett address)
codet get_clinit_call(const irep_idt &classname)
Each static access to classname should be prefixed with a check for necessary static init; this retur...
code_blockt convert_putstatic(const source_locationt &location, const exprt &arg0, const exprt::operandst &op, const symbol_exprt &symbol_expr)
code_ifthenelset convert_if(const java_bytecode_convert_methodt::address_mapt &address_map, const exprt::operandst &op, const irep_idt &id, const mp_integer &number, const source_locationt &location) const
methodt::instructionst instructionst
code_ifthenelset convert_ifnull(const java_bytecode_convert_methodt::address_mapt &address_map, const exprt::operandst &op, const mp_integer &number, const source_locationt &location) const
code_blockt & get_block_for_pcrange(block_tree_nodet &tree, code_blockt &this_block, method_offsett address_start, method_offsett address_limit, method_offsett next_block_start_address)
'tree' describes a tree of code_blockt objects; this_block is the corresponding block (thus they are ...
codet convert_pop(const irep_idt &statement, const exprt::operandst &op)
const bool threading_support
exprt::operandst pop(std::size_t n)
exprt::operandst & convert_const(const irep_idt &statement, const constant_exprt &arg0, exprt::operandst &results) const
const bool assert_no_exceptions_thrown
void convert_checkcast(const exprt &arg0, const exprt::operandst &op, codet &c, exprt::operandst &results) const
std::list< symbol_exprt > tmp_vars
void convert_dup2_x1(exprt::operandst &op, exprt::operandst &results)
code_blockt convert_putfield(const fieldref_exprt &arg0, const exprt::operandst &op)
code_blockt convert_multianewarray(const source_locationt &location, const exprt &arg0, const exprt::operandst &op, exprt::operandst &results)
code_ifthenelset convert_ifnonull(const java_bytecode_convert_methodt::address_mapt &address_map, const exprt::operandst &op, const mp_integer &number, const source_locationt &location) const
void convert(const symbolt &class_symbol, const methodt &, const optionalt< prefix_filtert > &method_context)
code_blockt convert_parameter_annotations(const methodt &method, const java_method_typet &method_type)
code_switcht convert_switch(const exprt::operandst &op, const java_bytecode_parse_treet::instructiont::argst &args, const source_locationt &location)
void save_stack_entries(const std::string &, code_blockt &, const bytecode_write_typet, const irep_idt &)
Create temporary variables if a write instruction can have undesired side- effects.
expanding_vectort< variablest > variables
void convert_new(const source_locationt &location, const exprt &arg0, codet &c, exprt::operandst &results)
exprt variable(const exprt &arg, char type_char, size_t address)
Returns an expression indicating a local variable suitable to load/store from a bytecode at address a...
std::map< method_offsett, converted_instructiont > address_mapt
static void replace_goto_target(codet &repl, const irep_idt &old_label, const irep_idt &new_label)
Find all goto statements in 'repl' that target 'old_label' and redirect them to 'new_label'.
code_blockt convert_iinc(const exprt &arg0, const exprt &arg1, const source_locationt &location, method_offsett address)
symbol_table_baset & symbol_table
exprt::operandst & convert_cmp2(const irep_idt &statement, const exprt::operandst &op, exprt::operandst &results) const
void convert_dup2(exprt::operandst &op, exprt::operandst &results)
optionalt< exprt > convert_invoke_dynamic(const source_locationt &location, std::size_t instruction_address, const exprt &arg0, codet &result_code)
bool is_method_inherited(const irep_idt &classname, const irep_idt &mangled_method_name) const
Returns true iff method methodid from class classname is a method inherited from a class or interface...
void convert_athrow(const source_locationt &location, const exprt::operandst &op, codet &c, exprt::operandst &results) const
typet method_return_type
Return type of the method under conversion.
void convert_getstatic(const source_locationt &source_location, const exprt &arg0, const symbol_exprt &symbol_expr, bool is_assertions_disabled_field, codet &c, exprt::operandst &results)
irep_idt method_id
Fully qualified name of the method under translation.
code_blockt convert_newarray(const source_locationt &location, const irep_idt &statement, const exprt &arg0, const exprt::operandst &op, exprt::operandst &results)
exprt::operandst & convert_shl(const irep_idt &statement, const exprt::operandst &op, exprt::operandst &results) const
exprt::operandst & convert_cmp(const exprt::operandst &op, exprt::operandst &results) const
void pop_residue(std::size_t n)
removes minimum(n, stack.size()) elements from the stack
void convert_invoke(source_locationt location, const irep_idt &statement, class_method_descriptor_exprt &class_method_descriptor, codet &c, exprt::operandst &results)
const size_t max_array_length
code_blockt & get_or_create_block_for_pcrange(block_tree_nodet &tree, code_blockt &this_block, method_offsett address_start, method_offsett address_limit, method_offsett next_block_start_address, const address_mapt &amap, bool allow_merge=true)
As above, but this version can additionally create a new branch in the block_tree-node and code_block...
const bool throw_assertion_error
codet convert_monitorenterexit(const irep_idt &statement, const exprt::operandst &op, const source_locationt &source_location)
irep_idt current_method
A copy of method_id :/.
static exprt convert_aload(const irep_idt &statement, const exprt::operandst &op)
symbol_exprt tmp_variable(const std::string &prefix, const typet &type)
std::vector< parametert > parameterst
This is a specialization of reference_typet.
codet replace_character_call(code_function_callt call)
Extract member of struct or union.
source_locationt source_location
Class that provides messages with a built-in verbosity 'level'.
message_handlert & get_message_handler()
Modulo defined as lhs-(rhs * truncate(lhs/rhs)).
Binary multiplication Associativity is not specified.
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
The null pointer constant.
Symbol table entry of function parameterThis is a symbol generated as part of type checking.
Given a string of the format '?blah?', will return true when compared against a string that matches a...
The plus expression Associativity is not specified.
const typet & base_type() const
The type of the data what we point to.
A side_effect_exprt representation of a side effect that throws an exception.
An expression containing a side effect.
const irep_idt & get_line() const
std::string as_string() const
void set_function(const irep_idt &function)
A struct tag type, i.e., struct_typet with an identifier.
Expression to hold a symbol (variable)
static symbol_exprt typeless(const irep_idt &id)
Generate a symbol_exprt without a proper type.
const irep_idt & get_identifier() const
The symbol table base class interface.
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
virtual std::pair< symbolt &, bool > insert(symbolt symbol)=0
Move or copy a new symbol to the symbol table.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
bool has_symbol(const irep_idt &name) const
Check whether a symbol exists in the symbol table.
bool add(const symbolt &symbol)
Add a new symbol to the symbol table.
const symbolt & lookup_ref(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
source_locationt location
Source code location of definition of symbol.
typet type
Type of symbol.
irep_idt name
The unique identifier.
irep_idt pretty_name
Language-specific display name.
irep_idt irep_idt base_name
Name of module the symbol belongs to.
exprt value
Initial value of symbol.
irep_idt mode
Language mode.
Semantic type conversion.
static exprt conditional_cast(const exprt &expr, const typet &type)
The type of an expression, extends irept.
The unary minus expression.
static irep_idt get_exception_type(const pointer_typet &)
Returns the compile type of an exception.
Fixed-width bit-vector with unsigned binary interpretation.
An exception that is raised for unsupported class signature.
bool has_prefix(const std::string &s, const std::string &prefix)
optionalt< exprt > zero_initializer(const typet &type, const source_locationt &source_location, const namespacet &ns)
Create the equivalent of zero for type type.
Expression Initialization.
API to expression classes for floating-point arithmetic.
const std::string & id2string(const irep_idt &d)
void convert_annotations(const java_bytecode_parse_treet::annotationst &parsed_annotations, std::vector< java_annotationt > &java_annotations)
Convert parsed annotations into the symbol table.
void create_parameter_symbols(const java_method_typet::parameterst ¶meters, expanding_vectort< std::vector< java_bytecode_convert_methodt::variablet > > &variables, symbol_table_baset &symbol_table)
static void gather_symbol_live_ranges(java_bytecode_convert_methodt::method_offsett pc, const exprt &e, std::map< irep_idt, java_bytecode_convert_methodt::variablet > &result)
static bool is_constructor(const irep_idt &method_name)
static irep_idt get_method_identifier(const irep_idt &class_identifier, const java_bytecode_parse_treet::methodt &method)
void java_bytecode_initialize_parameter_names(symbolt &method_symbol, const java_bytecode_parse_treet::methodt::local_variable_tablet &local_variable_table, symbol_table_baset &symbol_table)
This uses a cut-down version of the logic in java_bytecode_convert_methodt::convert to initialize sym...
static member_exprt to_member(const exprt &pointer, const fieldref_exprt &field_reference, const namespacet &ns)
Build a member exprt for accessing a specific field that may come from a base class.
static exprt conditional_array_cast(const exprt &expr, char type_char)
Add typecast if necessary to expr to make it compatible with array type corresponding to type_char (s...
void java_bytecode_convert_method(const symbolt &class_symbol, const java_bytecode_parse_treet::methodt &method, symbol_table_baset &symbol_table, message_handlert &message_handler, size_t max_array_length, bool throw_assertion_error, optionalt< ci_lazy_methods_neededt > needed_lazy_methods, java_string_library_preprocesst &string_preprocess, const class_hierarchyt &class_hierarchy, bool threading_support, const optionalt< prefix_filtert > &method_context, bool assert_no_exceptions_thrown)
java_method_typet member_type_lazy(const std::string &descriptor, const optionalt< std::string > &signature, const std::string &class_name, const std::string &method_name, message_handlert &message_handler)
Returns the member type for a method, based on signature or descriptor.
void create_parameter_names(const java_bytecode_parse_treet::methodt &m, const irep_idt &method_identifier, java_method_typet::parameterst ¶meters, const java_bytecode_convert_methodt::method_offsett &slots_for_parameters)
Extracts the names of parameters from the local variable table in the method, and uses it to construc...
void create_method_stub_symbol(const irep_idt &identifier, const irep_idt &base_name, const irep_idt &pretty_name, const typet &type, const irep_idt &declaring_class, symbol_table_baset &symbol_table, message_handlert &message_handler)
static std::size_t get_bytecode_type_width(const typet &ty)
static void adjust_invoke_argument_types(const java_method_typet::parameterst ¶meters, code_function_callt::argumentst &arguments)
static void assign_parameter_names(java_method_typet &ftype, const irep_idt &name_prefix, symbol_table_baset &symbol_table)
Iterates through the parameters of the function type ftype, finds a new new name for each parameter a...
static irep_idt get_if_cmp_operator(const u1 bytecode)
void java_bytecode_convert_method_lazy(symbolt &class_symbol, const irep_idt &method_identifier, const java_bytecode_parse_treet::methodt &m, symbol_table_baset &symbol_table, message_handlert &message_handler)
This creates a method symbol in the symtab, but doesn't actually perform method conversion just yet.
JAVA Bytecode Language Conversion.
JAVA Bytecode Language Conversion.
Java-specific exprt subclasses.
irep_idt clinit_wrapper_name(const irep_idt &class_name)
Get the Java static initializer wrapper name for a given class (the wrapper checks if static initiali...
Produce code for simple implementation of String Java libraries.
Representation of a constant Java string.
signedbv_typet java_int_type()
typet java_type_from_char(char t)
Constructs a type indicated by the given character:
java_reference_typet java_reference_array_type(const struct_tag_typet &subtype)
empty_typet java_void_type()
char java_char_from_type(const typet &type)
optionalt< typet > java_type_from_string(const std::string &src, const std::string &class_name_prefix)
Transforms a string representation of a Java type into an internal type representation thereof.
signedbv_typet java_byte_type()
std::string pretty_signature(const java_method_typet &method_type)
typet java_bytecode_promotion(const typet &type)
Java does not support byte/short return types. These are always promoted.
java_reference_typet java_array_type(const char subtype)
Construct an array pointer type.
signedbv_typet java_short_type()
reference_typet java_reference_type(const typet &subtype)
c_bool_typet java_boolean_type()
unsignedbv_typet java_char_type()
const typet & java_array_element_type(const struct_tag_typet &array_symbol)
Return a const reference to the element type of a given java array type.
const java_method_typet & to_java_method_type(const typet &type)
const java_class_typet & to_java_class_type(const typet &type)
void set_declaring_class(symbolt &symbol, const irep_idt &declaring_class)
Sets the identifier of the class which declared a given symbol to declaring_class.
unsigned java_method_parameter_slots(const java_method_typet &t)
Returns the the number of JVM local variables (slots) used by the JVM to pass, upon call,...
optionalt< irep_idt > declaring_class(const symbolt &symbol)
Gets the identifier of the class which declared a given symbol.
optionalt< resolve_inherited_componentt::inherited_componentt > get_inherited_component(const irep_idt &component_class_id, const irep_idt &component_name, const symbol_table_baset &symbol_table, bool include_interfaces)
Finds an inherited component (method or field), taking component visibility into account.
irep_idt strip_java_namespace_prefix(const irep_idt &to_strip)
Strip java:: prefix from given identifier.
dereference_exprt checked_dereference(const exprt &expr)
Dereference an expression and flag it for a null-pointer check.
unsigned java_local_variable_slots(const typet &t)
Returns the number of JVM local variables (slots) taken by a local variable that, when translated to ...
void merge_source_location_rec(exprt &expr, const source_locationt &source_location)
Attaches a source location to an expression and all of its subexpressions.
irep_idt lambda_synthetic_class_name(const irep_idt &method_identifier, std::size_t instruction_address)
static symbolt constructor_symbol(synthetic_methods_mapt &synthetic_methods, const irep_idt &synthetic_class_name, java_method_typet constructor_type)
Java lambda code synthesis.
const mp_integer string2integer(const std::string &n, unsigned base)
const std::string integer2string(const mp_integer &n, unsigned base)
Pattern matching for bytecode instructions.
const reference_typet & to_reference_type(const typet &type)
Cast a typet to a reference_typet.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
optionalt< resolve_inherited_componentt::inherited_componentt > get_inherited_method_implementation(const irep_idt &call_basename, const irep_idt &classname, const symbol_table_baset &symbol_table)
Given a class and a component, identify the concrete method it is resolved to.
Given a class and a component (either field or method), find the closest parent that defines that com...
#define CHECK_RETURN(CONDITION)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
const code_gotot & to_code_goto(const codet &code)
const code_labelt & to_code_label(const codet &code)
const code_blockt & to_code_block(const codet &code)
const codet & to_code(const exprt &expr)
API to expression classes.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
void replace(const union_find_replacet &replace_map, string_not_contains_constraintt &constraint)
static block_tree_nodet get_leaf()
std::vector< method_offsett > branch_addresses
std::vector< block_tree_nodet > branch
std::vector< exprt > argst
optionalt< std::string > signature
exception_tablet exception_table
std::vector< exceptiont > exception_tablet
std::vector< annotationst > parameter_annotations
Java annotations that were applied to parameters of this method.
std::vector< local_variablet > local_variable_tablet
source_locationt source_location
instructionst instructions
local_variable_tablet local_variable_table
std::vector< irep_idt > throws_exception_table
static optionalt< annotationt > find_annotation(const annotationst &annotations, const irep_idt &annotation_type_name)
Find an annotation given its name.
Over-approximative uncaught exceptions analysis.