Skip to content

Commit c764708

Browse files
author
Thomas Kiley
authored
Merge pull request #2829 from thk123/allow-extra-entry-points
Allow extra entry points loads to be specified [TG-4620]
2 parents 401a46c + 232da1d commit c764708

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

jbmc/src/java_bytecode/java_bytecode_language.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ void java_bytecode_languaget::get_language_options(const cmdlinet &cmd)
123123
extra_entry_points.end(),
124124
std::back_inserter(extra_methods),
125125
build_load_method_by_regex);
126+
const auto &new_points = build_extra_entry_points(cmd);
127+
extra_methods.insert(
128+
extra_methods.end(), new_points.begin(), new_points.end());
126129

127130
if(cmd.isset("java-cp-include-files"))
128131
{
@@ -1207,3 +1210,13 @@ bool java_bytecode_languaget::to_expr(
12071210
java_bytecode_languaget::~java_bytecode_languaget()
12081211
{
12091212
}
1213+
1214+
/// This method should be overloaded to provide alternative approaches for
1215+
/// specifying extra entry points. To provide a regex entry point, the command
1216+
/// line option `--lazy-methods-extra-entry-point` can be used directly.
1217+
std::vector<load_extra_methodst>
1218+
java_bytecode_languaget::build_extra_entry_points(
1219+
const cmdlinet &command_line) const
1220+
{
1221+
return {};
1222+
}

jbmc/src/java_bytecode/java_bytecode_language.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ class java_bytecode_languaget:public languaget
199199
std::vector<irep_idt> java_load_classes;
200200

201201
private:
202+
virtual std::vector<load_extra_methodst>
203+
build_extra_entry_points(const cmdlinet &command_line) const;
202204
const std::unique_ptr<const select_pointer_typet> pointer_type_selector;
203205

204206
/// Maps synthetic method names on to the particular type of synthetic method

jbmc/src/java_bytecode/java_types.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,31 +453,33 @@ class java_generic_typet:public reference_typet
453453
}
454454
};
455455

456+
template <>
457+
inline bool can_cast_type<java_generic_typet>(const typet &type)
458+
{
459+
return is_reference(type) && type.get_bool(ID_C_java_generic_type);
460+
}
461+
456462
/// \param type: the type to check
457463
/// \return true if type is java type containing with generics, e.g., List<T>
458464
inline bool is_java_generic_type(const typet &type)
459465
{
460-
return type.get_bool(ID_C_java_generic_type);
466+
return can_cast_type<java_generic_typet>(type);
461467
}
462468

463469
/// \param type: source type
464470
/// \return cast of type into java type with generics
465471
inline const java_generic_typet &to_java_generic_type(
466472
const typet &type)
467473
{
468-
PRECONDITION(
469-
type.id()==ID_pointer &&
470-
is_java_generic_type(type));
474+
PRECONDITION(can_cast_type<java_generic_typet>(type));
471475
return static_cast<const java_generic_typet &>(type);
472476
}
473477

474478
/// \param type: source type
475479
/// \return cast of type into java type with generics
476480
inline java_generic_typet &to_java_generic_type(typet &type)
477481
{
478-
PRECONDITION(
479-
type.id()==ID_pointer &&
480-
is_java_generic_type(type));
482+
PRECONDITION(can_cast_type<java_generic_typet>(type));
481483
return static_cast<java_generic_typet &>(type);
482484
}
483485

0 commit comments

Comments
 (0)