Use ~Transaction() to unload its JITed symbols.
This commit is contained in:
parent
8edeb7fbbe
commit
93e44e7273
@ -552,7 +552,7 @@ namespace cling {
|
||||
|
||||
//FIXME: Terrible hack to let the IncrementalParser run static inits on
|
||||
// transaction completed.
|
||||
ExecutionResult executeTransaction(Transaction& T) const;
|
||||
ExecutionResult executeTransaction(Transaction& T);
|
||||
|
||||
///\brief Evaluates given expression within given declaration context.
|
||||
///
|
||||
|
@ -38,6 +38,8 @@ namespace llvm {
|
||||
}
|
||||
|
||||
namespace cling {
|
||||
class IncrementalExecutor;
|
||||
|
||||
///\brief Contains information about the consumed input at once.
|
||||
///
|
||||
/// A transaction could be:
|
||||
@ -148,11 +150,14 @@ namespace cling {
|
||||
///
|
||||
std::unique_ptr<llvm::Module> m_Module;
|
||||
|
||||
///\brief The ExecutionEngine handle allowing an removal of the
|
||||
/// Transaction's symbols.
|
||||
///\brief The JIT handle allowing a removal of the Transaction's symbols.
|
||||
///
|
||||
ExeUnloadHandle m_ExeUnload;
|
||||
|
||||
///\brief The Executor to use m_ExeUnload on.
|
||||
///
|
||||
IncrementalExecutor* m_Exe;
|
||||
|
||||
///\brief The wrapper function produced by the intepreter if any.
|
||||
///
|
||||
clang::FunctionDecl* m_WrapperFD;
|
||||
@ -439,8 +444,12 @@ namespace cling {
|
||||
llvm::Module* getModule() const { return m_Module.get(); }
|
||||
void setModule(std::unique_ptr<llvm::Module> M) { m_Module.swap(M); }
|
||||
|
||||
ExeUnloadHandle getExeUnloadHandle() { return m_ExeUnload; }
|
||||
void setExeUnloadHandle(ExeUnloadHandle H) { m_ExeUnload = H; }
|
||||
ExeUnloadHandle getExeUnloadHandle() const { return m_ExeUnload; }
|
||||
IncrementalExecutor* getExecutor() const { return m_Exe; }
|
||||
void setExeUnloadHandle(IncrementalExecutor* Exe, ExeUnloadHandle H) {
|
||||
m_Exe = Exe;
|
||||
m_ExeUnload = H;
|
||||
}
|
||||
|
||||
clang::FunctionDecl* getWrapperFD() const { return m_WrapperFD; }
|
||||
|
||||
|
@ -1125,11 +1125,11 @@ namespace cling {
|
||||
}
|
||||
|
||||
Interpreter::ExecutionResult
|
||||
Interpreter::executeTransaction(Transaction& T) const {
|
||||
Interpreter::executeTransaction(Transaction& T) {
|
||||
assert(!isInSyntaxOnlyMode() && "Running on what?");
|
||||
assert(T.getState() == Transaction::kCommitted && "Must be committed");
|
||||
|
||||
T.setExeUnloadHandle(m_Executor->emitToJIT());
|
||||
T.setExeUnloadHandle(m_Executor.get(), m_Executor->emitToJIT());
|
||||
|
||||
// Forward to IncrementalExecutor; should not be called by
|
||||
// anyone except for IncrementalParser.
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "cling/Interpreter/Transaction.h"
|
||||
|
||||
#include "cling/Utils/AST.h"
|
||||
#include "IncrementalExecutor.h"
|
||||
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/DeclBase.h"
|
||||
@ -47,6 +48,7 @@ namespace cling {
|
||||
m_Next = 0;
|
||||
//m_Sema = S;
|
||||
m_BufferFID = FileID(); // sets it to invalid.
|
||||
m_Exe = 0;
|
||||
}
|
||||
|
||||
Transaction::~Transaction() {
|
||||
@ -57,6 +59,8 @@ namespace cling {
|
||||
&& "All nested transactions must be committed!");
|
||||
delete (*m_NestedTransactions)[i];
|
||||
}
|
||||
if (getExecutor())
|
||||
getExecutor()->unloadFromJIT(getExeUnloadHandle());
|
||||
}
|
||||
|
||||
NamedDecl* Transaction::containsNamedDecl(llvm::StringRef name) const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user