[LLVMdev] [MCJIT] Why does it allocate function by function?

Yuri yuri at rawbw.com
Tue Jul 5 18:04:47 PDT 2011

I am implementing ELFObject class for MCJIT to be able to run ELFs on 

One thing bothers me: I see that the RTDyldMemoryManager-based allocator 
is always passed to MCJIT and to RuntimeDyld classes from outside. This 
enforces the approach that memory will be allocated function by function 
with startFunctionBody/endFunctionBody. This maybe was good for the old 
JIT, but not for MCJIT.

For ELF for example this isn't right. ELF is designed to be loaded into 
memory as a whole. I don't know much about MachO, but most likely it 
should be normally loaded into memory by OS in one block too, as a 
consequence of efficiency considerations.

So is this a design flaw that should be fixed? Or am I missing something?

I think I can lower the allocator from MCJIT into inside of RuntimeDyld. 
So at least ELF will be able to use the bulk allocator. But I though I 
ask here first.

Thank you,

More information about the llvm-dev mailing list