[llvm-dev] JIT-Client for Shared Memory

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 7 08:34:18 PST 2018


Adding Lang here in case he's got some insight.

I take it the system you're targeting doesn't have the memory limitations
that some systems have, where once memory is set executable, it can never
be written to? & so you'd like to write some code into a page, execute it,
write some more code into the same page and have that execute too?

(I don't know teh JIT architecture well enough to know if that's supported,
or if I'm accurately understanding your situation, etc)

On Thu, Nov 1, 2018 at 11:49 PM Gaier, Bjoern via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hello everyone,
>
>
>
> I want to use the LLVM to write a JIT client, that works with shared
> memory. Currently I proceed as following:
>
>
>
> I wrote an own class that inherits "*RTDyldMemoryManager*". The functions
> "*allocateCodeSection*" and "*allocateDataSection*" are allocating local
> non-shared memory. I store there addresses in a std::vector.
>
> When the function "*notifyObjectLoaded*" is invoked, I allocate the
> shared memory - I'm getting the size from the local non-shared memory - and
> apply the address mapping.
>
> When the function "*finalizeMemory*" is invoked I copy the code from the
> local non-shared memory to the shared memory but only one time.
>
>
>
> So far so good, this works actually good! Yippie x3
>
>
>
> BUT... There is one problem. The shared memory can't be dynamical
> adjusted. So if I add another module to the current module, then I would go
> through this process again! Not the "*finalizeMemory*" process though,
> but I would allocate another shared memory. This is not what I want!
> Currently I use the linker first, to work around this problem, but this
> will not help me if I add object files or libraries to the JIT process - or
> does it?
>
>
>
> So is there any way to work around this?
>
>
>
> Kind greetings
>
> Björn
> Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816,
> USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert
> Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima.
> Junichi Tajika
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181107/cff4280a/attachment.html>


More information about the llvm-dev mailing list