[LLVMdev] [MCJIT] Why does it allocate function by function?
Yuri
yuri at rawbw.com
Wed Jul 6 10:34:11 PDT 2011
On 07/06/2011 09:42, Jim Grosbach wrote:
> I agree the approach is not optimal. If we were designing completely from scratch, I would absolutely do it differently. We're not, however, and can't simply throw away what we have and start over without significant pain. It's better to instead work incrementally. The first step is to implement with the current interfaces and get the MCJIT non-trivially functional. There are a lot of problems we can solve without needing to tackle the memory manager right off the bat. Doing so will also give us better insight into what the eventual design of the memory manager should be. That way we improve our chances of getting the design done more cleanly and not having to refactor it yet again later.
But this requires a lot of extra-coding and ugly result just to satisfy
the 100% API back compatibility of function by function allocation.
>> > I think the right and simple solution would be to make the allocators an internal affair of JIT, so that old JIT defines and uses JITMemoryManager inside as it needs, and MCJIT doesn't, and clients don't see any of this.
> I don't follow. How can the clients not see it? They define their own memory managers and pass them into the JIT. See LLDB for an example.
Unfortunately I don't use Mac for development and can't see the benefits
of lldb. I think building on linux might be a good idea for it.
My suggestion was to not pass the memory allocator to JIT/MCJIT at all
and let them allocate themselves as they need, everywhere including lldb
assuming it's applicable.
The next suggestion is amending the existing JITMemoryManager interface
with the bulk allocation method that will allocate RWX memory block.
And yet next suggestion will be to ignore the passed from outside
allocator for MCJIT ELF object for now since lldb doesn't run on ELF
platforms anyway.
Yuri
More information about the llvm-dev
mailing list