Eager JIT

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.

Sure, you can turn off lazy compilation. Take a look at NoLazyCompilation in lli.cpp.


Thanks Evan!