julia
edf1cd0c - CompilerDevTools: add proof of concept for caching runtime calls (#57193)

Commit
1 year ago
CompilerDevTools: add proof of concept for caching runtime calls (#57193) This PR leverages new capabilities that have been implemented in https://github.com/JuliaLang/julia/pull/56660 to also support caching methods for runtime calls under a custom `AbstractInterpreter`. In my understanding, the idea is that when executing code compiled with a custom `AbstractInterpreter`, only methods that can be compiled ahead of execution will be cached, because dynamic calls requiring runtime compilation will not have enough context to know which interpreter and cache to use. They will instead use the native interpreter and cache. This sample package demonstrates a way to ensure that runtime calls go through an entry point (`with_new_compiler`) that provides the context required to use the right cache and interpreter for subsequent compilation. I'd be happy to get feedback on the logic used to redirect runtime calls to `with_new_compiler`. Overloading `optimize(::SplitCacheInterp)` seemed the most convenient (right after that, the `IRCode` gets converted to a `CodeInfo`), but perhaps there might be a better place for it. --------- Co-authored-by: Cédric Belmant <cedric.belmant@juliahub.com>
Author
Parents
Loading