Initial Patch to Support Speculative Compilation in ORC v2 APIs. Idea is to replicate the mapping provided by the lazyreexports utility (SymbolAliasMap) to find which Callable Symbol the stubs symbols lazy reexports and where the Callable Symbol lives (Impl JITDylibs).
Instrument IR with calls to the run time function __orc_speculate_for at the entry block of Functions which calls other functions. At run time the call to __orc_speculate_for triggers the compilation of functions and update the pointer of the lazy reexports stubs.
This Patch introduces two maps : Imap and SpeculationMap,
Imap - replicates the source symbols and impl JITDylibs for each alias.
Speculation Map - lives inside the Speculator, which keeps track of for each function address what are the likely functions that the function may call at runtime.
Simple flow is at runtime Speculator queries the Imap to find the source symbols and impl JITDylibs.
Things to do:
1. Write run time function implementation.
2. Make Stub Pointer Updation through Notify Resolved.
3. Test cases.