Hi all, Is there any way to generate the binary code for a whole module at once? Currently I always get lazy compilation one function at a time. The reason I would like to generate the whole module at once is because I create some functions at run-time and then minimize the memory footprint by deallocating all LLVM objects. I've written my own JITMemoryManager to ensure that the binary code itself does not get deleted. Unfortunately, with lazy compilation the stub tries to call an LLVM method while everything else has already been deleted. It looks like JIT::getPointerToFunctionOrStub is responsibe for creating the stubs, and I've tried overloading it to emit the function instead of a stub, but unfortunately the JIT class has a private constructor, making it impossible to create a derived class. Is there any other way to achieve this without changing LLVM code? Or does this sound like a feature worth adding to LLVM itself? Thanks a lot, Nicolas Capens P.S: MSVC users, please comment on my previous e-mail "MSVC solution relative paths". Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080707/4910fd9c/attachment.html>
Sure, you can turn off lazy compilation. Take a look at NoLazyCompilation in lli.cpp. Evan On Jul 7, 2008, at 6:08 AM, Nicolas Capens wrote:> Hi all, > > Is there any way to generate the binary code for a whole module at > once? Currently I always get lazy compilation one function at a time. > > The reason I would like to generate the whole module at once is > because I create some functions at run-time and then minimize the > memory footprint by deallocating all LLVM objects. I’ve written my > own JITMemoryManager to ensure that the binary code itself does not > get deleted. Unfortunately, with lazy compilation the stub tries to > call an LLVM method while everything else has already been deleted. > > It looks like JIT::getPointerToFunctionOrStub is responsibe for > creating the stubs, and I’ve tried overloading it to emit the > function instead of a stub, but unfortunately the JIT class has a > private constructor, making it impossible to create a derived class. > > Is there any other way to achieve this without changing LLVM code? > Or does this sound like a feature worth adding to LLVM itself? > > Thanks a lot, > > Nicolas Capens > > P.S: MSVC users, please comment on my previous e-mail “MSVC solution > relative paths”. Thanks. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080707/6df0f71d/attachment.html>
Thanks Evan! From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Evan Cheng Sent: Monday, 07 July, 2008 19:29 To: LLVM Developers Mailing List Subject: Re: [LLVMdev] Eager JIT Sure, you can turn off lazy compilation. Take a look at NoLazyCompilation in lli.cpp. Evan On Jul 7, 2008, at 6:08 AM, Nicolas Capens wrote: Hi all, Is there any way to generate the binary code for a whole module at once? Currently I always get lazy compilation one function at a time. The reason I would like to generate the whole module at once is because I create some functions at run-time and then minimize the memory footprint by deallocating all LLVM objects. I've written my own JITMemoryManager to ensure that the binary code itself does not get deleted. Unfortunately, with lazy compilation the stub tries to call an LLVM method while everything else has already been deleted. It looks like JIT::getPointerToFunctionOrStub is responsibe for creating the stubs, and I've tried overloading it to emit the function instead of a stub, but unfortunately the JIT class has a private constructor, making it impossible to create a derived class. Is there any other way to achieve this without changing LLVM code? Or does this sound like a feature worth adding to LLVM itself? Thanks a lot, Nicolas Capens P.S: MSVC users, please comment on my previous e-mail "MSVC solution relative paths". Thanks. _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080709/2a0d6663/attachment.html>