20 :
log(message_handler)
30 "symex-complexity-failed-child-loops-limit");
38 if(failed_child_loops_limit > 0)
50 for(
auto frame_iter = current_call_stack.rbegin();
51 frame_iter != current_call_stack.rend();
56 if(!frame_iter->active_loops.empty())
58 return &frame_iter->active_loops.back();
69 for(
auto frame_iter = current_call_stack.rbegin();
70 frame_iter != current_call_stack.rend();
73 for(
auto &loop_iter : frame_iter->active_loops)
75 for(
auto &blacklisted_loop : loop_iter.blacklisted_loops)
77 if(blacklisted_loop.get().contains(instr))
91 std::size_t sum_complexity = 0;
106 for(
auto frame_iter = current_call_stack.rbegin();
107 frame_iter != current_call_stack.rend();
110 for(
auto it = frame_iter->active_loops.rbegin();
111 it != frame_iter->active_loops.rend();
114 auto &loop_info = *it;
119 if(loop_to_blacklist)
121 loop_info.blacklisted_loops.emplace_back(*loop_to_blacklist);
125 sum_complexity += loop_info.children_too_complex;
128 loop_to_blacklist = &loop_info.loop;
134 return !loop_to_blacklist;
143 std::size_t complexity =
148 auto ¤t_call_stack = state.
call_stack();
156 if(active_loop !=
nullptr)
158 active_loop->children_too_complex++;
164 <<
"[symex-complexity] Loop operations considered too complex"
165 << (state.
source.
pc->source_location().is_not_nil()
166 ?
" at: " + state.
source.
pc->source_location().as_string()
167 :
", location number: " +
175 log.
warning() <<
"[symex-complexity] Branch considered too complex"
176 << (state.
source.
pc->source_location().is_not_nil()
178 state.
source.
pc->source_location().as_string()
179 :
", location number: " +
196 log.
warning() <<
"[symex-complexity] Trying to enter blacklisted loop"
197 << (state.
source.
pc->source_location().is_not_nil()
199 state.
source.
pc->source_location().as_string()
200 :
", location number: " +
219 transform_lambda.transform(complexity_violation, current_state);
231 for(
const auto &op : ops)
complexity_limitert(message_handlert &logger, const optionst &options)
complexity_violationt check_complexity(goto_symex_statet &state)
Checks the passed-in state to see if its become too complex for us to deal with, and if so set its gu...
bool complexity_limits_active()
Is the complexity module active?
static std::size_t bounded_expr_size(const exprt &expr, std::size_t limit)
Amount of nodes in expr approximately bounded by limit.
bool complexity_active
Is the complexity module active, usually coincides with a max_complexity value above 0.
static bool in_blacklisted_loop(const call_stackt ¤t_call_stack, const goto_programt::const_targett &instr)
Checks whether we're in a loop that is currently considered blacklisted, and shouldn't be executed.
std::size_t max_complexity
The max complexity rating that a branch can be before it's abandoned.
std::vector< symex_complexity_limit_exceeded_actiont > violation_transformations
Functions called when the heuristic has been violated.
std::size_t max_loops_complexity
The amount of branches that can fail within the scope of a loops execution before the entire loop is ...
static framet::active_loop_infot * get_current_active_loop(call_stackt ¤t_call_stack)
Returns inner-most currently active loop.
symex_complexity_limit_exceeded_actiont default_transformation
Default heuristic transformation. Sets state as unreachable.
void run_transformations(complexity_violationt complexity_violation, goto_symex_statet ¤t_state)
Runs a suite of transformations on the state and symex executable, performing whatever transformation...
bool are_loop_children_too_complicated(call_stackt ¤t_call_stack)
Checks whether the current loop execution stack has violated max_loops_complexity.
Base class for all expressions.
instructionst::const_iterator const_targett
bool reachable
Is this code reachable? If not we can take shortcuts such as not entering function calls,...
Central data structure: state.
call_stackt & call_stack()
symex_targett::sourcet source
A loop, specified as a set of instructions.
mstreamt & warning() const
signed int get_signed_int_option(const std::string &option) const
virtual void transform(const complexity_violationt heuristic_result, goto_symex_statet ¤t_state)
static std::size_t bounded_expr_size(const exprt &expr, std::size_t count, std::size_t limit)
Amount of nodes expr contains, with a bound on how far to search.
complexity_violationt
What sort of symex-complexity violation has taken place.
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
goto_programt::const_targett pc