[LLVMdev] GSOC Adaptive Compilation Framework for LLVM JIT Compiler

Owen Anderson resistor at mac.com
Mon Apr 4 10:49:53 PDT 2011


On Apr 3, 2011, at 12:11 PM, Eric Christopher wrote:

> <snip conversation about call patching>

It seems to me that there's a general feature here that LLVM is lacking, that would be useful in a number of JIT-compilation contexts, namely the ability to mark certain instructions (direct calls, perhaps branches too) as back-patchable.  

The thing that stands out to me is that back-patching a call or branch in a JIT'd program is very much like relocation resolution that a dynamic linker does at launch time for a statically compiled program.  It seems like it might be possible to build on top of the runtime-dyld work that Jim has been doing for the MC-JIT to facilitate this.   Here's the idea:

Suppose we had a means of tagging certain calls (and maybe branches) as explicitly requiring relocations.  Any back-patchable call would have a relocation in the generated code, and the MC-JIT would be aware of the location and type of the relocations, and rt-dyld would handle the upfront resolution.  Backpatching, then, is just a matter of updating the resolution for a given symbol, and asking rt-dyld to re-link the executable code.

Thoughts?

--Owen




More information about the llvm-dev mailing list