Refactored the expression parser so that the IR

and the JITted code are managed by a standalone
class that handles memory management itself.

I have removed RecordingMemoryManager and
ProcessDataAllocator, which filled similar roles
and had confusing ownership, with a common class
called IRExecutionUnit.  The IRExecutionUnit
manages all allocations ever made for an expression
and frees them when it goes away.  It also contains
the code generator and can vend the Module for an
expression to other clases.

The end goal here is to make the output of the
expression parser re-usable; that is, to avoid
re-parsing when re-parsing isn't necessary.

I've also cleaned up some code and used weak pointers
in more places.  Please let me know if you see any
leaks; I checked myself as well but I might have
missed a case.

llvm-svn: 177364
This commit is contained in:
Sean Callanan
2013-03-19 00:10:07 +00:00
parent 807e4dced5
commit 8dfb68e039
17 changed files with 1371 additions and 1314 deletions

View File

@@ -264,18 +264,17 @@ ClangFunction::WriteFunctionWrapper (ExecutionContext &exe_ctx, Stream &errors)
bool evaluated_statically = false; // should stay that way
Error jit_error (m_parser->PrepareForExecution (m_jit_alloc,
m_jit_start_addr,
Error jit_error (m_parser->PrepareForExecution (m_jit_start_addr,
m_jit_end_addr,
exe_ctx,
NULL,
evaluated_statically,
const_result,
eExecutionPolicyAlways));
if (!jit_error.Success())
return false;
if (process && m_jit_alloc != LLDB_INVALID_ADDRESS)
if (process && m_jit_start_addr)
m_jit_process_wp = lldb::ProcessWP(process->shared_from_this());
m_JITted = true;