@@ -2949,18 +2949,19 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
29492949 } else {
29502950 ref<Expr> v = eval (ki, 0 , state).value ;
29512951
2952- if (!isa<ConstantExpr>(v) && MockExternalCalls) {
2953- if (ki->inst ->getType ()->isSized ()) {
2954- prepareMockValue (state, " mockExternResult" , ki);
2955- }
2956- } else {
2957- ExecutionState *free = &state;
2958- bool hasInvalid = false , first = true ;
2959-
2960- /* XXX This is wasteful, no need to do a full evaluate since we
2961- have already got a value. But in the end the caches should
2962- handle it for us, albeit with some overhead. */
2963- do {
2952+ ExecutionState *free = &state;
2953+ bool hasInvalid = false , first = true ;
2954+
2955+ /* XXX This is wasteful, no need to do a full evaluate since we
2956+ have already got a value. But in the end the caches should
2957+ handle it for us, albeit with some overhead. */
2958+ do {
2959+ if (!first && MockExternalCalls) {
2960+ free = nullptr ;
2961+ if (ki->inst ->getType ()->isSized ()) {
2962+ prepareMockValue (state, " mockExternResult" , ki);
2963+ }
2964+ } else {
29642965 v = optimizer.optimizeExpr (v, true );
29652966 ref<ConstantExpr> value;
29662967 bool success = solver->getValue (free->constraints .cs (), v, value,
@@ -2993,8 +2994,8 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
29932994 first = false ;
29942995 free = res.second ;
29952996 timers.invoke ();
2996- } while (free && !haltExecution);
2997- }
2997+ }
2998+ } while (free && !haltExecution);
29982999 }
29993000 break ;
30003001 }
0 commit comments