Where is the code for this? Does this refer to
You’ll find the code for the client side in
llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp (and associated header), and the server code in
llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.cpp (and associated header).
Does it mean functions similar to
sys::Memory::allocateMappedMemory etc. for shared memory?
That’s not entirely clear yet. It may end up looking like
sys::Memory, but the design should be driven by the needs of the
JITLinkMemoryManager API, and the solution might end up looking like a more elaborate version of
There is an orthogonal project (one that might end up being folded into this one if you’re interested) to create a slab-based allocator – an allocator that reserves chunks of memory up-front to enable use of the default code models (which assume that all code/data for the library is located within a narrow address range). I think an ideal off-the-shelf JITLink memory manager would look something like this:
MemoryMapper (reserve slabs, apply protections, release slabs) +
SlabManager (allocates and tracks memory within slabs) +
SideChannel (sends commands to run finalization actions);
Where the MemoryMapper could be implemented via shared memory (where available) or EPC (where shared memory is not an option).
Finally what other resources, code etc. should I look at and what can I do to get more familiar with the relevant things?
Do you already know the shared memory APIs for your OS? If not, I think I’d start there. If you’re able to play around with them on multiple OSes that’s even better.
Then I would prototype the ideas using the
llvm-jitlink-executor tools. You could do this by hacking
SimpleExecutorMemoryManager (or making copies and hacking those, if you wanted this to be something that you could develop in-tree).
I hope that gives you some ideas to get started, but I know it’s also quite high level. If you’re looking for more specifics I’m happy to answer any follow-up questions.