69 for(std::size_t
i=0;
i<parameters.size(); ++
i)
73 if(
i==0 && parameters[
i].get_this())
76 base_name=
"stub_ignored_arg"+std::to_string(
i);
79 parameters[
i].set_base_name(base_name);
80 parameters[
i].set_identifier(identifier);
104 symbol.
name = identifier;
116 log.
debug() <<
"Generating codet: new opaque symbol: method '" << symbol.
name
118 symbol_table.
add(symbol);
136 for(std::size_t
i=0;
i<
n;
i++)
155 for(std::size_t
i=0;
i<o.size();
i++)
166 const std::string &prefix,
221 return std::move(result);
232 const std::string &descriptor,
234 const std::string &class_name,
252 "Must be code type");
253 if(signature.has_value())
262 "Must be code type");
272 <<
"\n signature: " << signature.value()
273 <<
"\n descriptor: " << descriptor
274 <<
"\n different number of parameters, reverting to "
282 <<
"\n could not parse signature: " << signature.value()
283 <<
"\n " << e.what() <<
"\n"
284 <<
" reverting to descriptor: " << descriptor
351 parameters.insert(parameters.begin(),
this_p);
402 symbol_table.
add(method_symbol);
439 if(v.index >= slots_for_parameters)
442 std::ostringstream
id_oss;
452 variables[v.index].emplace_back(result, v.start_pc, v.length);
459 std::size_t param_index = 0;
460 for(
const auto &
param : parameters)
463 variables[param_index].size() <= 1,
464 "should have at most one entry per index");
468 param_index == slots_for_parameters,
469 "java_parameter_count and local computation must agree");
471 for(
auto &
param : parameters)
480 if(param_index == 0 &&
param.get_this())
486 else if(!variables[param_index].empty())
489 base_name = variables[param_index][0].symbol_expr.get(
ID_C_base_name);
490 identifier = variables[param_index][0].symbol_expr.get(
ID_identifier);
498 base_name =
"arg" + std::to_string(param_index) + suffix;
501 param.set_base_name(base_name);
502 param.set_identifier(identifier);
508 param_index == slots_for_parameters,
509 "java_parameter_count and local computation must agree");
518 std::size_t param_index = 0;
519 for(
const auto &
param : parameters)
529 variables[param_index].
clear();
530 variables[param_index].emplace_back(
533 std::numeric_limits<size_t>::max(),
582 "Name of method symbol shouldn't change");
585 "Base name of method symbol shouldn't change");
587 method_symbol.module.empty(),
588 "Method symbol shouldn't have module");
612 "Member type should have already been marked as a constructor");
630 method_symbol.
value = std::move(code);
637 if(bytecode ==
patternt(
"if_?cmplt"))
639 if(bytecode ==
patternt(
"if_?cmple"))
641 if(bytecode ==
patternt(
"if_?cmpgt"))
643 if(bytecode ==
patternt(
"if_?cmpge"))
645 if(bytecode ==
patternt(
"if_?cmpeq"))
647 if(bytecode ==
patternt(
"if_?cmpne"))
650 throw "unhandled java comparison instruction";
662 const exprt &pointer,
684 components.size() != 0,
685 "infer_opaque_type_fields should guarantee that a member access has a "
686 "corresponding field");
705 const auto &
stmt=
repl.get_statement();
714 for(
auto &op :
repl.operands())
791 tree.branch_addresses.begin(),
792 tree.branch_addresses.end(),
803 tree.branch_addresses.begin(),
804 tree.branch_addresses.end(),
862 for(
auto p :
checkit->second.predecessors)
867 <<
"warning: refusing to create lexical block spanning "
869 <<
" due to incoming edge " << p <<
" -> " <<
checkit->first
889 log.
debug() <<
"Generating codet: combining "
932 newnode.branch_addresses.insert(
933 newnode.branch_addresses.begin(),
953 std::map<irep_idt, java_bytecode_convert_methodt::variablet> &result)
958 auto findit = result.emplace(
959 std::piecewise_construct,
960 std::forward_as_tuple(
symexpr.get_identifier()),
961 std::forward_as_tuple(
symexpr, pc, 1));
964 auto &var =
findit.first->second;
968 var.length+=(var.start_pc-pc);
973 var.length=std::max(var.length, (pc-var.start_pc)+1);
1019 std::size_t param_index =
method_type.has_this() ? 1 : 0;
1022 "parameters and parameter annotations mismatch");
1037 parameters[param_index].get_identifier();
1046 check_loc.set_comment(
"Not null annotation check");
1047 check_loc.set_property_class(
"not-null-annotation-check");
1072 std::set<method_offsett> targets;
1077 for(
auto i_it = instructions.begin();
i_it != instructions.end();
i_it++)
1080 std::pair<address_mapt::iterator, bool>
a_entry=
1081 address_map.insert(std::make_pair(
i_it->address,
ins));
1087 const auto bytecode =
i_it->bytecode;
1100 instructionst::const_iterator next=
i_it;
1101 if(++next!=instructions.end())
1102 a_entry.first->second.successors.push_back(next->address);
1126 const std::vector<method_offsett>
handler =
1128 std::list<method_offsett> &successors =
a_entry.first->second.successors;
1129 successors.insert(successors.end(),
handler.begin(),
handler.end());
1135 bytecode ==
patternt(
"if_?cmp??") ||
1146 targets.insert(target);
1148 a_entry.first->second.successors.push_back(target);
1152 auto next = std::next(
i_it);
1154 next != instructions.end(),
"jsr should have valid return address");
1155 targets.insert(next->address);
1162 for(
const auto &arg :
i_it->args)
1167 targets.insert(target);
1168 a_entry.first->second.successors.push_back(target);
1173 else if(bytecode ==
BC_ret)
1181 for(
const auto &address : address_map)
1183 for(
auto s : address.second.successors)
1185 const auto a_it = address_map.find(s);
1187 a_it->second.predecessors.insert(address.first);
1203 if(!instructions.empty())
1215 if(instruction.done)
1218 instruction.successors.begin(), instruction.successors.end());
1220 instructionst::const_iterator
i_it = instruction.source;
1221 stack.swap(instruction.stack);
1222 instruction.stack.
clear();
1223 codet &
c = instruction.code;
1226 stack.empty() || instruction.predecessors.size() <= 1 ||
1232 const auto bytecode =
i_it->bytecode;
1237 if(statement.size()>=2 &&
1238 statement[statement.size()-2]==
'_' &&
1239 isdigit(statement[statement.size()-1]))
1244 std::string(
id2string(statement), statement.size()-1, 1)),
1256 if(
cur_pc==it->handler_pc)
1259 catch_type !=
typet() ||
1266 catch_type=it->catch_type;
1272 if(catch_type!=
typet())
1324 "java::org.cprover.CProver.assume:(Z)V")
1329 "function expected to have exactly one parameter");
1355 "invokeinterface, invokespecial, invokevirtual and invokestatic should "
1356 "be called with a class method descriptor expression as arg0");
1366 else if(bytecode ==
patternt(
"?return"))
1375 else if(bytecode ==
patternt(
"?astore"))
1380 else if(bytecode ==
patternt(
"?store") || bytecode ==
patternt(
"?store_?"))
1385 statement,
arg0, op,
i_it->address,
i_it->source_location);
1387 else if(bytecode ==
patternt(
"?aload"))
1403 "String and Class literals should have been lowered in "
1404 "generate_constant_global_variables");
1426 std::next(
i_it)->address,
1430 else if(bytecode ==
BC_ret)
1445 else if(bytecode ==
patternt(
"?const_?"))
1450 else if(bytecode ==
patternt(
"?ipush"))
1455 "ipush argument expected to be constant");
1458 else if(bytecode ==
patternt(
"if_?cmp??"))
1464 address_map, bytecode, op, number,
i_it->source_location);
1466 else if(bytecode ==
patternt(
"if??"))
1479 INVARIANT(!
id.empty(),
"unexpected bytecode-if");
1485 else if(bytecode ==
patternt(
"ifnonnull"))
1492 else if(bytecode ==
patternt(
"ifnull"))
1503 else if(bytecode ==
patternt(
"?xor"))
1508 else if(bytecode ==
patternt(
"?or"))
1513 else if(bytecode ==
patternt(
"?and"))
1518 else if(bytecode ==
patternt(
"?shl"))
1523 else if(bytecode ==
patternt(
"?shr"))
1528 else if(bytecode ==
patternt(
"?ushr"))
1533 else if(bytecode ==
patternt(
"?add"))
1538 else if(bytecode ==
patternt(
"?sub"))
1543 else if(bytecode ==
patternt(
"?div"))
1548 else if(bytecode ==
patternt(
"?mul"))
1553 else if(bytecode ==
patternt(
"?neg"))
1558 else if(bytecode ==
patternt(
"?rem"))
1568 else if(bytecode ==
patternt(
"?cmp"))
1573 else if(bytecode ==
patternt(
"?cmp?"))
1578 else if(bytecode ==
patternt(
"?cmpl"))
1583 else if(bytecode ==
BC_dup)
1631 field_name.find(
"$assertionsDisabled")!=std::string::npos;
1641 i_it->source_location,
1710 else if(bytecode ==
patternt(
"?2?"))
1725 else if(bytecode ==
BC_new)
1785 else if(bytecode ==
BC_nop)
1807 if(!
i_it->source_location.get_line().empty())
1812 instruction.done =
true;
1813 for(
const auto address : instruction.successors)
1815 address_mapt::iterator
a_it2=address_map.find(address);
1828 if(!
stack.empty() &&
a_it2->second.predecessors.size()>1)
1835 if(
a_it2->second.stack.empty())
1837 for(stackt::iterator
s_it=
stack.begin();
1852 "Stack sizes should be the same.");
1853 stackt::const_iterator
os_it=
a_it2->second.stack.begin();
1854 for(
auto &expr :
stack)
1877 if(last_statement.get_statement()==
ID_goto)
1880 if(last_statement.get_statement() !=
ID_block)
1884 last_statement.operands().begin(),
1902 new_symbol.
name=var.get_identifier();
1903 new_symbol.
type=var.type();
1960 "Block addresses should be unique and increasing");
1978 for(
const auto &
aentry : address_map)
1986 for(
const auto &v :
vlist)
2011 v.start_pc + v.length,
2012 std::numeric_limits<method_offsett>::max(),
2021 if(v.symbol_expr.get_identifier().empty())
2027 v.start_pc + v.length,
2028 std::numeric_limits<method_offsett>::max());
2030 block.statements().insert(block.statements().begin(), d);
2065 for(
auto a_it = args.begin();
a_it != args.end();
2081 if(
a_it == args.begin())
2110 const irep_idt descriptor = (statement ==
"monitorenter") ?
2111 "java::java.lang.Object.monitorenter:(Ljava/lang/Object;)V" :
2112 "java::java.lang.Object.monitorexit:(Ljava/lang/Object;)V";
2122 call.add_source_location() = source_location;
2125 return std::move(
call);
2184 if(is_double || is_float)
2194 value.from_integer(number);
2197 value.from_expr(
arg0);
2219 parameters.size() == arguments.size(),
2220 "for each parameter there must be exactly one argument");
2221 for(std::size_t
i = 0;
i < parameters.size();
i++)
2223 const typet &type = parameters[
i].type();
2241 const bool use_this(statement !=
"invokestatic");
2242 const bool is_virtual(
2243 statement ==
"invokevirtual" || statement ==
"invokeinterface");
2248 "invoke statement arg0 must have an identifier");
2263 "Function return type must not change in kind");
2278 if(parameters.empty() || !parameters[0].get_this())
2285 parameters.insert(parameters.begin(),
this_p);
2290 if(statement ==
"invokespecial")
2310 "first argument must be a pointer");
2379 std::move(lhs), std::move(function), std::move(arguments));
2380 call.add_source_location() = location;
2381 call.function().add_source_location() = location;
2406 c.add_source_location() = location;
2418 assert_class.add_source_location().set_comment(
"Dynamic cast check");
2419 assert_class.add_source_location().set_property_class(
"bad-dynamic-cast");
2475 typedef std::vector<std::reference_wrapper<
2481 if(exception.start_pc ==
cur_pc)
2494 exception_list.emplace_back(
2495 exception.catch_type.get_identifier(),
2498 label(std::to_string(exception.handler_pc)));
2580 if(statement ==
"newarray")
2644 c.add_source_location() = location;
2677 "stack_static_field",
2747 const int nan_value(statement[4] ==
'l' ? -1 : 1);
2912 code_branch.cond().add_source_location() = location;
2959 g.add_source_location() = location;
2970 branch.cond().add_source_location() = location;
2971 branch.add_source_location() = location;
2990 "java::array[boolean]") ||
3027 "iload can be used for boolean, byte, short, int and char");
3033 "Variable type must match [adflv]load return type");
3114 if(!value.has_value())
3167 std::vector<java_bytecode_parse_treet::instructiont>::const_iterator>
3179std::vector<java_bytecode_convert_methodt::method_offsett>
3185 std::vector<method_offsett> result;
3209 &local_variable_table,
3222 std::map<std::size_t, base_name_and_identifiert>
param_names;
3223 for(
const auto &v : local_variable_table)
3225 if(v.index < slots_for_parameters)
3233 std::size_t param_index = 0;
3234 for(
auto &
param : parameters)
3243 if(param_index == 0 &&
param.get_this())
3264 base_name =
"arg" + std::to_string(param_index) + suffix;
3269 param.set_base_name(base_name);
3270 param.set_identifier(identifier);
3289 size_t max_array_length,
3290 bool throw_assertion_error,
3294 bool threading_support,
3296 bool assert_no_exceptions_thrown)
3303 throw_assertion_error,
3304 needed_lazy_methods,
3308 assert_no_exceptions_thrown);
3320 const irep_idt &mangled_method_name)
const
3335 const irep_idt &component_name)
const
3358 const std::function<
bool(
3359 const std::function<
tvt(
const exprt &expr)>,
const exprt &expr)>
3362 const exprt &expr) {
3364 if(
tvres.is_unknown())
3370 return entry_matches(predicate, expr);
3375 return tvres.is_true();
3383 const exprt &expr) {
3393 [&identifier](
const exprt &expr) {
3396 :
tvt(symbol_expr->get_identifier() == identifier);
3403 [](
const exprt &expr) {
3404 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.
std::size_t get_width() const
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 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)
codet & find_last_statement()
A codet representing the declaration of a local variable.
codet representation of an expression statement.
codet representation of a "return from a function" statement.
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.
void set_label(const irep_idt &label)
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.
const parameterst & parameters() const
const typet & return_type() const
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.
constant_exprt largest_expr() const
Return an expression representing the largest value of this type.
constant_exprt smallest_expr() const
Return an expression representing the smallest value of this type.
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)
const methodst & methods() const
std::vector< parametert > parameterst
void set_is_final(bool is_final)
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.
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a 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.
const irep_idt & get_identifier() const
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)
#define forall_operands(it, expr)
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 java_bytecode_convert_method_lazy(symbolt &class_symbol, const irep_idt &method_identifier, const java_bytecode_parse_treet::methodt &m, symbol_tablet &symbol_table, message_handlert &message_handler)
This creates a method symbol in the symtab, but doesn't actually perform method conversion just yet.
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)
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.
optionalt< resolve_inherited_componentt::inherited_componentt > get_inherited_component(const irep_idt &component_class_id, const irep_idt &component_name, const symbol_tablet &symbol_table, bool include_interfaces)
Finds an inherited component (method or field), taking component visibility into account.
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.
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_tablet &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...
static optionalt< smt_termt > get_identifier(const exprt &expr, const std::unordered_map< exprt, smt_identifier_termt, irep_hash > &expression_handle_identifiers, const std::unordered_map< exprt, smt_identifier_termt, irep_hash > &expression_identifiers)
#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.