From 8dfb68e0398ef48d41dc8ea058e9aa750b5fc85f Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Tue, 19 Mar 2013 00:10:07 +0000 Subject: 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 --- lldb/source/Expression/ClangUtilityFunction.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'lldb/source/Expression/ClangUtilityFunction.cpp') diff --git a/lldb/source/Expression/ClangUtilityFunction.cpp b/lldb/source/Expression/ClangUtilityFunction.cpp index 2f41ae9a2f3..e457bb94655 100644 --- a/lldb/source/Expression/ClangUtilityFunction.cpp +++ b/lldb/source/Expression/ClangUtilityFunction.cpp @@ -104,8 +104,6 @@ ClangUtilityFunction::Install (Stream &error_stream, m_expr_decl_map.reset(new ClangExpressionDeclMap(keep_result_in_memory, exe_ctx)); - m_data_allocator.reset(new ProcessDataAllocator(*process)); - if (!m_expr_decl_map->WillParse(exe_ctx)) { error_stream.PutCString ("error: current process state is unsuitable for expression parsing\n"); @@ -133,23 +131,13 @@ ClangUtilityFunction::Install (Stream &error_stream, bool evaluated_statically = false; // should stay that way - Error jit_error = parser.PrepareForExecution (m_jit_alloc, - m_jit_start_addr, + Error jit_error = parser.PrepareForExecution (m_jit_start_addr, m_jit_end_addr, exe_ctx, - m_data_allocator.get(), evaluated_statically, const_result, eExecutionPolicyAlways); - if (log) - { - StreamString dump_string; - m_data_allocator->Dump(dump_string); - - log->Printf("Data buffer contents:\n%s", dump_string.GetString().c_str()); - } - if (m_jit_start_addr != LLDB_INVALID_ADDRESS) m_jit_process_wp = lldb::ProcessWP(process->shared_from_this()); -- cgit v1.2.3