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

Sean Silva silvas at purdue.edu
Fri May 17 12:07:27 PDT 2013


On Fri, May 17, 2013 at 12:41 PM, Filip Pizlo <fpizlo at apple.com> wrote:

>
>
> So what about going with this (I don't know if this is what Sean was
> thinking or if this is my idea):
>
> - LLVMCustomMCJITMemoryManager is an opaque.
>
> - You create it with:
>
> LLVMCreateCustomMCJITMemoryManager(void *Object, uint8_t
> *(*AllocateCodeSegment)(...), uint8_t *(*AllocateDataSegment)(...),
> LLVMBool (*ApplyPermissions)(...), void (*Destroy)(...));
>
>
This makes a lot of sense to me. What I initially had in mind was basically
the same idea, but with a getter/setter for each field, but this design you
are suggesting seems more robust for this use case, since it centralizes
the "have you filled in all the required fields" checking.

Your suggestion is also superior because it eliminates a class of errors
(and races, in a multithreaded context) where the MCJMM is mutated via a
setter while it is already in use.

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130517/b3ccbfdf/attachment.html>


More information about the llvm-commits mailing list