Mercurial > hg > octave-lojdl
changeset 14955:609dcc297db5
src/pt-jit.cc (jit_info::~jit_info): New function
author | Max Brister <max@2bass.com> |
---|---|
date | Fri, 15 Jun 2012 14:10:24 -0500 |
parents | 2871d5f8d922 |
children | 466cb8673653 |
files | src/pt-jit.cc src/pt-jit.h |
diffstat | 2 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pt-jit.cc +++ b/src/pt-jit.cc @@ -2820,13 +2820,12 @@ // -------------------- jit_info -------------------- jit_info::jit_info (tree_jit& tjit, tree& tee) - : engine (tjit.get_engine ()) + : engine (tjit.get_engine ()), llvm_function (0) { - llvm::Function *fun = 0; try { jit_convert conv (tjit.get_module (), tee); - fun = conv.get_function (); + llvm_function = conv.get_function (); arguments = conv.get_arguments (); bounds = conv.get_bounds (); } @@ -2838,22 +2837,28 @@ #endif } - if (! fun) + if (! llvm_function) { function = 0; return; } - tjit.optimize (fun); + tjit.optimize (llvm_function); #ifdef OCTAVE_JIT_DEBUG std::cout << "-------------------- optimized llvm ir --------------------\n"; llvm::raw_os_ostream llvm_cout (std::cout); - fun->print (llvm_cout); + llvm_function->print (llvm_cout); std::cout << std::endl; #endif - function = reinterpret_cast<jited_function>(engine->getPointerToFunction (fun)); + function = reinterpret_cast<jited_function>(engine->getPointerToFunction (llvm_function)); +} + +jit_info::~jit_info (void) +{ + if (llvm_function) + llvm_function->eraseFromParent (); } bool
--- a/src/pt-jit.h +++ b/src/pt-jit.h @@ -2273,6 +2273,8 @@ public: jit_info (tree_jit& tjit, tree& tee); + ~jit_info (void); + bool execute (void) const; bool match (void) const; @@ -2283,6 +2285,7 @@ llvm::ExecutionEngine *engine; jited_function function; + llvm::Function *llvm_function; std::vector<std::pair<std::string, bool> > arguments; type_bound_vector bounds;