[LLVMdev] JITted code in multiple threads

Aaron Dwyer llvmification at gmail.com
Wed Feb 27 01:10:41 PST 2008


I just thought of something that scared me, and I'm hoping there is a
happy ending.  I realized recently that the JITter does not
necessarily finish JITting inside of getPointerToFunction.  Instead,
it often generates stubs which get a final JIT only upon jumping to
them.  Now--I am in the situation where I'd like to do a
getPointerToFunction, and then take the pointer and pass it out to
multiple cores to execute the code I've generated in parallel.  This
seems like a problem--if jumping to an address means code will be
munged, then two or more cores trying to jump to that address at the
same time might all try to JIT the stubs, resulting in a barrage of
random code!!

This seems like a very obvious issue, so I'm guessing there is a
simple answer for this.  What are peoples' thoughts?  Any and all are
appreciated.

Aaron



More information about the llvm-dev mailing list