[PATCH] Expose custom MC-JIT memory allocation through the C API

Filip Pizlo fpizlo at apple.com
Wed May 15 18:58:27 PDT 2013


This patch allows a C API client to supply their own memory manager.

My main motivation for this is: https://bugs.webkit.org/show_bug.cgi?id=113619.  WebKit wants to use the C API, since it's more stable.  WebKit already has its own JIT memory management and cache management logic, and we need LLVM to allocate from WebKit's JIT memory pool.

To make this work without causing dependency issues, the dummy destructor for RTDyldMemoryManager is moved into libLLVMExecutionEngine, and it's also now in its own header.  This allows ExecutionEngineBindings to speak of RTDyldMemoryManager.

The memory manager API is exposed as callbacks in the LLVMMCJITMemoryManagerFunctions struct.  The user is allowed to leave most of the functions NULL, and reasonable defaults are provided.

This patch also adds a test of the memory manager API, by round-tripping through the C API callback back into the SectionMemoryManager.

-Filip

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcjmm-c.patch
Type: application/octet-stream
Size: 27573 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130515/bc9112da/attachment.obj>


More information about the llvm-commits mailing list