about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2021-03-20 22:10:03 +0000
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2021-04-20 11:42:23 +0100
commite2cb581253b18b50d6526cc4a28ee7ff933a29bf (patch)
treeb4f0809619cadb0d60b456ce364c8f066ef944d2 /lib
parent458e3f9ec4f8d5d2711a0aeff7a532b184e7d075 (diff)
downloadklee-e2cb581253b18b50d6526cc4a28ee7ff933a29bf.tar.gz
Refactored maxStaticPctChecks into a sequence of conditions.
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/Executor.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 7bfc0dac..6891dc93 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -986,18 +986,28 @@ ref<Expr> Executor::maxStaticPctChecks(ExecutionState &current,
 
   StatisticManager &sm = *theStatisticManager;
   CallPathNode *cpn = current.stack.back().callPathNode;
-  if ((MaxStaticForkPct < 1. &&
-       sm.getIndexedValue(stats::forks, sm.getIndex()) >
-           stats::forks * MaxStaticForkPct) ||
-      (MaxStaticCPForkPct < 1. && cpn &&
-       (cpn->statistics.getValue(stats::forks) >
-        stats::forks * MaxStaticCPForkPct)) ||
+
+  bool reached_max_fork_limit =
+      (MaxStaticForkPct < 1. &&
+       (sm.getIndexedValue(stats::forks, sm.getIndex()) >
+        stats::forks * MaxStaticForkPct));
+
+  bool reached_max_cp_fork_limit = (MaxStaticCPForkPct < 1. && cpn &&
+                                    (cpn->statistics.getValue(stats::forks) >
+                                     stats::forks * MaxStaticCPForkPct));
+
+  bool reached_max_solver_limit =
       (MaxStaticSolvePct < 1 &&
-       sm.getIndexedValue(stats::solverTime, sm.getIndex()) >
-           stats::solverTime * MaxStaticSolvePct) ||
+       (sm.getIndexedValue(stats::solverTime, sm.getIndex()) >
+        stats::solverTime * MaxStaticSolvePct));
+
+  bool reached_max_cp_solver_limit =
       (MaxStaticCPForkPct < 1. && cpn &&
        (cpn->statistics.getValue(stats::solverTime) >
-        stats::solverTime * MaxStaticCPSolvePct))) {
+        stats::solverTime * MaxStaticCPSolvePct));
+
+  if (reached_max_fork_limit || reached_max_cp_fork_limit ||
+      reached_max_solver_limit || reached_max_cp_solver_limit) {
     ref<klee::ConstantExpr> value;
     bool success = solver->getValue(current.constraints, condition, value,
                                     current.queryMetaData);