[LLVMdev] Jit singleton

Olivier Meurant meurant.olivier at gmail.com
Thu Feb 4 05:47:34 PST 2010

Hi everyone !

If I call ExecutionEngine::createJIT (or EngineBuilder::create) more than
one time, the second time fails on a assertion "Multiple JIT resolvers?".
It seems that the JIT is designed to be a singleton in the process, and I
was wondering if it was something mandatory.
How hard will it be to make it a non-singleton object ? Is this a JIT-only
problem (work needed on JIT classes only) ? Is it a much wider design
constraint (on codegen ?) ?

In case, if you ask why I want to create more than one JIT, here is a reason
I have a JIT application which works fine, a thread is responsible to
prepare code execution (work on module, add functions, optimize, call
JIT...) and a another thread is responsible for executing the code produced
in the first thread.
It works great, but the preparation thread is heavily loaded. I decide to
look at what happens, if I spawns 2 threads for preparation of the code.
I have a working prototype, which have one module and one context by thread,
and it works. But the JIT is still shared between 2 threads and the time
needed to emit a function is not negligible. It will be a great boost of
performances, if I can create one execution engine by thread.

What do you think ? Do you have any comments on it ?
Thanks for reading !

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100204/431a22cd/attachment.html>

More information about the llvm-dev mailing list