Hi All,
Summary:
I think we should merge the LLVM OrcTargetProcess and compiler-rt ORC runtime libraries into a new top-level “orc-rt” project.
Background:
LLVM’s ORC JIT APIs support cross-process and cross-architecture execution of JIT’d code. Support code for out-of-process execution falls into two categories:
(1) Code that must be pre-linked into the executing process to bootstrap JIT’d code (e.g. memory managers, symbol resolvers, the JIT “executor-process-control server” code).
(2) Runtime support for advanced object format features for JIT’d code, e.g. static initializers, destructors, exceptions and thread-local-storage. This can be JIT-linked into the executor process by ORC.
Code for (1) currently lives in the LLVM OrcTargetProcess library, and code for (2) in the compiler-rt ORC runtime library.
Motivation
Moving this code into a new top-level project would address a few issues with our current setup:
-
The bootstrap code could be built for all systems that the compiler targets, rather than just the host architecture. (OrcTargetProcess is currently only built for the LLVM host architecture).
-
Compiler-rt developers wouldn’t have to explicitly opt out of building the ORC runtime (which many, if not most, compiler-rt devs do not use).
-
JIT developers wouldn’t have to build all of compiler-rt (or explicitly opt out of all other compiler-rt libraries) in order to test the JIT.
Proposal
We should move the OrcTargetProcess and ORC runtime libraries into a new top-level “orc-rt” project inside llvm-project. We should also replace the llvm-jitlink-executor
test tool with an orc-executor
test tool in the new “orc-rt” project. This would allow us to implement out-of-process execution tests in “orc-rt” alongside the existing regression tests from the compiler-rt ORC runtime library.
We should duplicate some basic bootstrap support in LLVM: enough to provide the same level of functionality as MCJIT (this will allow MCJIT clients to move to ORC without building the new project). Use of more advanced features (including lazy compilation, thread local storage, out-of-process initializers / deinitializers, etc.), may in future require building the “orc-rt” project. Since this would only involve enabling one extra top-level LLVM project I think it’s a reasonable burden to place on JIT developers
What do you think?
I’ve started putting together a sketch of the new project in to serve as a basis for discussion / prototyping for anyone who wants to get involved: