From d773e3f762affd7189d34fbd6d1e7e0e5af3f712 Mon Sep 17 00:00:00 2001 From: Frank Busse Date: Wed, 11 Sep 2019 21:19:24 +0100 Subject: refactor PTree: remove split(), add attach() method --- lib/Core/Executor.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'lib/Core/Executor.cpp') diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 56753bb1..1ba6d9bf 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -430,7 +430,7 @@ Executor::Executor(LLVMContext &ctx, const InterpreterOptions &opts, : Interpreter(opts), interpreterHandler(ih), searcher(0), externalDispatcher(new ExternalDispatcher(ctx)), statsTracker(0), pathWriter(0), symPathWriter(0), specialFunctionHandler(0), - processTree(0), replayKTest(0), replayPath(0), usingSeeds(0), + replayKTest(0), replayPath(0), usingSeeds(0), atMemoryLimit(false), inhibitForking(false), haltExecution(false), ivcEnabled(false), debugLogBuffer(debugBufferString) { @@ -551,7 +551,6 @@ Executor::setModule(std::vector> &modules, Executor::~Executor() { delete memory; delete externalDispatcher; - delete processTree; delete specialFunctionHandler; delete statsTracker; delete solver; @@ -825,11 +824,7 @@ void Executor::branch(ExecutionState &state, ExecutionState *ns = es->branch(); addedStates.push_back(ns); result.push_back(ns); - es->ptreeNode->data = 0; - std::pair res = - processTree->split(es->ptreeNode, ns, es); - ns->ptreeNode = res.first; - es->ptreeNode = res.second; + processTree->attach(es->ptreeNode, ns, es); } } @@ -1077,11 +1072,7 @@ Executor::fork(ExecutionState ¤t, ref condition, bool isInternal) { } } - current.ptreeNode->data = 0; - std::pair res = - processTree->split(current.ptreeNode, falseState, trueState); - falseState->ptreeNode = res.first; - trueState->ptreeNode = res.second; + processTree->attach(current.ptreeNode, falseState, trueState); if (pathWriter) { // Need to update the pathOS.id field of falseState, otherwise the same id @@ -3847,11 +3838,9 @@ void Executor::runFunctionAsMain(Function *f, initializeGlobals(*state); - processTree = new PTree(state); - state->ptreeNode = processTree->root; + processTree = std::make_unique(state); run(*state); - delete processTree; - processTree = 0; + processTree = nullptr; // hack to clear memory objects delete memory; -- cgit 1.4.1