[LLVMdev] JIT relocations and stub memory issue

Evan Cheng evan.cheng at apple.com
Tue Apr 14 16:19:43 PDT 2009


On Apr 13, 2009, at 8:09 AM, Eric wrote:

> Hi All,
>
> Can anyone explain why the MachineRelocation field "NeedsStub" is  
> set to true for GlobalValues on x86_64, but

That's true for large code model or Mac OS X. Right now, x86_64  
targets uses small code model by default. However, in JIT, the GV  
memory are allocated in heap and they are not guaranteed to be  
*close*. So the JIT is currently emitting stubs for all of them.

Evan

> false on plain x86? This is causing the JITEmitter to allocate a  
> stub for every GlobalValue relocation it encounters on x86_64,  
> quickly exhausting the 512K region for stubs in the default JIT  
> memory manager. Is this expected behavior? Is there anyway to  
> override the stub generation? In this case, why are stubs even being  
> allocated, my understanding was that they were merely placeholders  
> for lazy JIT?
>
> The same application running on plain x86 requires no such stubs and  
> therefore runs correctly. There is currently no stub deallocation  
> functionality in the default memory manager, so the x86_64 version  
> can only JIT a few thousand functions before the ExecutionEngine  
> crashes with a JIT: Ran out of space for function stubs error.
>
> Thoughts?
>
> Thanks,
> Eric
> _______________________________________________
> 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