Question about reusing executable object memory get from MCJIT->getPointerToFunction

Hi, All

Can we still use the compiled executable object even if module and
execution associated with it are already gone? It looks like for the
same function I am able to reuse the executable object storage
obtained from the previous getPointerToFunction even if the module and
execution compiling that function have already been deleted. My
understanding is that those storage containing executable instruction
from finalizeObject and getPointerToFunction are associated with
module and execution engine, if module and EE are deleted, those
storage are void and we should not use them again.

Am I right and I am just luck that those storage haven't been deleted yet?

Hi Cheng,

If your underlying ExecutionEngine is MCJIT then I think you will be able to get away with calling that memory as long as your RTDyldMemoryManager instance is still alive. Like a lot of JIT semantics though, this isn’t codified anywhere. I would be be wary of relying on it. My take is that once the ExecutionEngine is gone, the JIT’d code should no longer be called.