1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00
llvm-mirror/unittests/ExecutionEngine/Orc
Lang Hames a020f7f14c [ORC][ORC-RT] Introduce ORC-runtime based MachO-Platform.
Adds support for MachO static initializers/deinitializers and eh-frame
registration via the ORC runtime.

This commit introduces cooperative support code into the ORC runtime and ORC
LLVM libraries (especially the MachOPlatform class) to support macho runtime
features for JIT'd code. This commit introduces support for static
initializers, static destructors (via cxa_atexit interposition), and eh-frame
registration. Near-future commits will add support for MachO native
thread-local variables, and language runtime registration (e.g. for Objective-C
and Swift).

The llvm-jitlink tool is updated to use the ORC runtime where available, and
regression tests for the new MachOPlatform support are added to compiler-rt.

Notable changes on the ORC runtime side:

1. The new macho_platform.h / macho_platform.cpp files contain the bulk of the
runtime-side support. This includes eh-frame registration; jit versions of
dlopen, dlsym, and dlclose; a cxa_atexit interpose to record static destructors,
and an '__orc_rt_macho_run_program' function that defines running a JIT'd MachO
program in terms of the jit- dlopen/dlsym/dlclose functions.

2. Replaces JITTargetAddress (and casting operations) with ExecutorAddress
(copied from LLVM) to improve type-safety of address management.

3. Adds serialization support for ExecutorAddress and unordered_map types to
the runtime-side Simple Packed Serialization code.

4. Adds orc-runtime regression tests to ensure that static initializers and
cxa-atexit interposes work as expected.

Notable changes on the LLVM side:

1. The MachOPlatform class is updated to:

  1.1. Load the ORC runtime into the ExecutionSession.
  1.2. Set up standard aliases for macho-specific runtime functions. E.g.
       ___cxa_atexit -> ___orc_rt_macho_cxa_atexit.
  1.3. Install the MachOPlatformPlugin to scrape LinkGraphs for information
       needed to support MachO features (e.g. eh-frames, mod-inits), and
       communicate this information to the runtime.
  1.4. Provide entry-points that the runtime can call to request initializers,
       perform symbol lookup, and request deinitialiers (the latter is
       implemented as an empty placeholder as macho object deinits are rarely
       used).
  1.5. Create a MachO header object for each JITDylib (defining the __mh_header
       and __dso_handle symbols).

2. The llvm-jitlink tool (and llvm-jitlink-executor) are updated to use the
runtime when available.

3. A `lookupInitSymbolsAsync` method is added to the Platform base class. This
can be used to issue an async lookup for initializer symbols. The existing
`lookupInitSymbols` method is retained (the GenericIRPlatform code is still
using it), but is deprecated and will be removed soon.

4. JIT-dispatch support code is added to ExecutorProcessControl.

The JIT-dispatch system allows handlers in the JIT process to be associated with
'tag' symbols in the executor, and allows the executor to make remote procedure
calls back to the JIT process (via __orc_rt_jit_dispatch) using those tags.

The primary use case is ORC runtime code that needs to call bakc to handlers in
orc::Platform subclasses. E.g. __orc_rt_macho_jit_dlopen calling back to
MachOPlatform::rt_getInitializers using __orc_rt_macho_get_initializers_tag.
(The system is generic however, and could be used by non-runtime code).

The new ExecutorProcessControl::JITDispatchInfo struct provides the address
(in the executor) of the jit-dispatch function and a jit-dispatch context
object, and implementations of the dispatch function are added to
SelfExecutorProcessControl and OrcRPCExecutorProcessControl.

5. OrcRPCTPCServer is updated to support JIT-dispatch calls over ORC-RPC.

6. Serialization support for StringMap is added to the LLVM-side Simple Packed
Serialization code.

7. A JITLink::allocateBuffer operation is introduced to allocate writable memory
attached to the graph. This is used by the MachO header synthesis code, and will
be generically useful for other clients who want to create new graph content
from scratch.
2021-07-19 19:50:16 +10:00
..
CMakeLists.txt [ORC] Add wrapper-function support methods to ExecutorProcessControl. 2021-07-01 18:21:49 +10:00
CoreAPIsTest.cpp [ORC] Add more synchronization to TestLookupWithUnthreadedMaterialization. 2021-05-22 07:59:24 -07:00
ExecutorProcessControlTest.cpp [ORC] Add wrapper-function support methods to ExecutorProcessControl. 2021-07-01 18:21:49 +10:00
IndirectionUtilsTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
JITTargetMachineBuilderTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LazyCallThroughAndReexportsTest.cpp Re-apply "[ORC] Make MaterializationResponsibility immovable..." with fixes. 2020-09-11 14:09:05 -07:00
ObjectLinkingLayerTest.cpp [ORC] Add support for adding LinkGraphs directly to ObjectLinkingLayer. 2021-05-13 21:44:13 -07:00
OrcCAPITest.cpp Reland [Orc] Add verylazy example for C-bindings 2021-07-18 21:17:49 +02:00
OrcTestCommon.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OrcTestCommon.h [ORC] Remove the OrcExecutionTest class. It is no longer used. 2021-05-13 18:32:36 -07:00
QueueChannel.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
QueueChannel.h [ORC] Move Orc RPC code into Shared, rename some RPC types. 2020-12-30 12:48:20 +11:00
ResourceTrackerTest.cpp [Orc] Fix a file header (NFC) 2021-03-02 15:07:34 +01:00
RPCUtilsTest.cpp [RGT] RPCUtilsTest, replace un-executed EXPECT with unreachable 2021-03-17 07:37:21 -07:00
RTDyldObjectLinkingLayerTest.cpp [Orc] Remove unnecessary <string> include dependency from Orc headers. NFC. 2021-07-18 12:31:13 +01:00
SimplePackedSerializationTest.cpp [ORC][ORC-RT] Introduce ORC-runtime based MachO-Platform. 2021-07-19 19:50:16 +10:00
SymbolStringPoolTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadSafeModuleTest.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
WrapperFunctionUtilsTest.cpp [ORC] Add wrapper-function support methods to ExecutorProcessControl. 2021-07-01 18:21:49 +10:00