Hello LLVM-Mailing list,
in the past I was using the MCJIT (if I understand it correctly) to load IR modules, compile them and execute them. The speciality of this JIT was, that it was writing the compiled code into a shared memory - for a different process to execute them. For that task the JIT used a ‘custom’ memory manager, memory mapping and also resolved undefined references itself.
I was told some month ago, that MCJIT is heavily outdated and that I should move on to Orc JIT. So I did this today by reading the first Kaleidoscope Tutorial. Of course, I’m far away from having an understanding about the Orc JIT but I already miss all of the features I need to port my old JIT to the Orc JIT.
So I did some research and have some questions now:
1.) Memory Manager
I saw that I can actually replace the Memory Manager via the constructor of the “RTDyldObjectLinkingLayer” - is that correct?
I think, but I’m not sure, that I can use a JITDyLib to inject my own addresses for different functions, but I’m not sure how to do that - or if I’m correct with it.
3.) Legacy Layer
I later looked into the third Kaleidoscope Tutorial, seeing the “LegacyRTDyldObjectLinkingLayer” and “LegacyIRCompileLayer” - that looked promising!
But sadly the tutorial state that it was not updated yet to the new OrcJIT API - so… I have difficulties ‘trusting’ that tutorial. Does it mean, that those Legacy Layer will be removed soon? Or that you should not use them? The term legacy worries me actually.
4.) Reusing the JIT
With the MCJIT I noticed that you can not simply ‘reset’ the JIT and re-run it for a new compilation. What I mean with that is, I wanted to compile a IR module and then reset the MCJIT like it never compiled anything, so that I can set it up again, while not having to free the memory I already allocated.
Is something possible with the Orc JIT?
Thank you for your help in advance!