[LLVMdev] C API for hooking MCJIT's resolving of out-of-module references?

Lang Hames lhames at gmail.com
Fri Apr 24 13:47:35 PDT 2015


Hi Per,

It doesn't look like there's any way to do this with the existing C-API. I
suspect this isn't an issue for the FTL developers as they resolve most
(perhaps all?) of their symbols at the IR level.

I think it would be possible to extend the C-API to support symbol
resolution callbacks: We could add a new variant of the
LLVMCreateSimpleMCJITMemoryManager function which also takes a symbol
resolution callback.

Cheers,
Lang.

On Fri, Apr 24, 2015 at 3:17 AM, Per Mildner <Per.Mildner at sics.se> wrote:

> I am trying to port the Kaleidoscope tutorials to use the C API.
>
> This worked up to part 3, but the code for part 4 (where MCJIT support is
> added), creates a custom memory manager, in C++, that is then added with
> setMCJITMemoryManager().
>
> The custom memory manager is used in order to resolve references from a
> module to symbols outside the module, e.g. to symbols representing code
> jitted in other modules.
>
> So, how can I hook the way MCJIT resolves out-of-module references, using
> only the C API? Alternatively, is there some other way to handle cross
> module references?
>
> I briefly looked at the WebKit FTL code. They (mostly) use the C API but I
> could not see how symbol references were handled.
>
> (I use the C API because the surrounding application is written in C, so
> adding my own C wrappers for unexposed functionality is not an attractive
> option.)
>
> Thanks in advance,
>
>
> Per Mildner
> Per.Mildner at sics.se
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150424/00942927/attachment.html>


More information about the llvm-dev mailing list