[LLVMdev] Multiple modules JITting

Caldarale, Charles R Chuck.Caldarale at unisys.com
Wed Oct 16 19:56:50 PDT 2013


> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Mikhail Lyapunov
> Subject: [LLVMdev] Multiple modules JITting

> We're looking for a way to use LLVM to JIT many modules, assuming that 
> the full list of modules and their content are not available at a time 
> when some of jitted pieces are already in use.

We do this in our project, using MCJIT.

> Is it feasible to destruct ExecutionEngine but keep jitted code alive?

Yes; we use our own memory manager, extending SectionMemoryManager (not JITMemoryManager).  An instance of the memory manager is created and destroyed with each ExecutionEngine, so we use it as a wrapper for our actual allocation mechanism; this allows the code/data lifetime to be managed independently of the ExecutionEngine and Module.

> Are jitted binary codes position independent?

We have not found a way to do this, even when creating a TargetMachine with PIC_, but perhaps we're missing some trick.

> is there a way to relocate

Haven't figured that out either.

> If the solution requires custom implementation of JITMemoryManager: is 
> there a way to get exact (or sufficient) memory size for binary code 
> before the actual code generation?

The MCJIT makes calls to various allocate*() methods of SectionMemoryManager with exact sizes specified before writing out the code and data sections.  This is a distinct advantage over the legacy JIT.

 - Chuck





More information about the llvm-dev mailing list