Skip functions that take too much memory doing undef construction
this operation can double memory size in the worst case
MODIFY
ir/state.cpp
ir/state.cpp
#include "ir/state.h"
#include "ir/function.h"
#include "smt/expr.h"
+#include "smt/smt.h"
#include <cassert>
using namespace smt;
@@ -50,6 +51,9 @@ const StateValue& State::operator[](const Value &val) {
repls.emplace_back(u, expr::mkVar(name.c_str(), u.bits()));
}
+ if (hit_half_memory_limit())
+ throw OutOfMemory();
+
auto sval_new = sval.subst(repls);
if (sval_new.eq(sval)) {
uvars.clear();

MODIFY
ir/state.h
ir/state.h
namespace IR {
struct LoopInCFGDetected : public std::exception {};
+struct OutOfMemory : public std::exception {};
struct StateValue {

MODIFY
tools/transform.cpp
tools/transform.cpp
@@ -232,8 +232,10 @@ Errors TransformVerify::verify() const {
try {
sym_exec(src_state);
sym_exec(tgt_state);
- } catch (LoopInCFGDetected &e) {
- return "WARNING: Loops not supported yet! Skipping function.";
+ } catch (LoopInCFGDetected&) {
+ return "Loops are not supported yet! Skipping function.";
+ } catch (OutOfMemory&) {
+ return "Out of memory; skipping function.";
}
Errors errs;

Skip functions that take too much memory doing undef construction
this operation can double memory size in the worst case