[LLVMdev] Correct way of JITing multiple modules?

Evan Cheng evan.cheng at apple.com
Tue Sep 2 01:23:28 PDT 2008


On Aug 31, 2008, at 7:54 AM, David Chisnall wrote:

> Hi,
>
> I'm trying to work out the correct way of JITing multiple modules.
> My original approach was to create a new ExecutionEngine for each
> Module, however this generates an assert failure.  If I create a new

Right. That won't work.

>
> ModuleProvider for each new Module and then add this to a single
> ExecutionEngine then I have a problem with static constructors not

Multiple ModuleProvider is the right solution.

>
> being run.  With a single module, I can call
> runStaticConstructorsDestructors().  With the second one, neither
> ommitting this nor calling it a second time appears to work (I don't
> think either of these is exactly correct, since I don't want to run
> the static constructors on pre-existing modules twice, I just want
> static ctors to run in the new module).

You can add a new runStaticConstructorsDestructors which takes a  
Module as argument and runs only the static initializers for the  
module. You can model it after the existing  
runStaticConstructorsDestructors. It should be pretty straight forward.

Evan

>
>
> Can anyone advise?
>
> David
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list