[PATCH] [MCJIT] Add two useful utility functions
lhames at gmail.com
Wed Jun 17 11:48:36 PDT 2015
When you call addObjectFile, MCJIT will call NotifyObjectEmitted immediately on each registered event listener, passing a reference to the original ObjectFile, and to the LoadedObjectInfo. If you specifically want to inspect the object file currently being loaded you could raise a flag on your event listener:
MyEventListener.NextObjectIsSpecial = true;
I'm not a fan of callbacks in general, and I agree that this is a bit ugly. However, I prefer callbacks for handling loaded objects in MCJIT because they encourage you to treat JIT'd objects and precompiled ones uniformly, which is usually what you want.
If you feel strongly about this I don't mind the method being added, as long as it's not exposed via the C API.
Shameless plug: In Orc you could add trivial custom layer for this. ;)
More information about the llvm-commits