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 7d9758f33a [ORC] Add ThreadSafeModule and ThreadSafeContext wrappers to support concurrent
compilation of IR in the JIT.

ThreadSafeContext is a pair of an LLVMContext and a mutex that can be used to
lock that context when it needs to be accessed from multiple threads.

ThreadSafeModule is a pair of a unique_ptr<Module> and a
shared_ptr<ThreadSafeContext>. This allows the lifetime of a ThreadSafeContext
to be managed automatically in terms of the ThreadSafeModules that refer to it:
Once all modules using a ThreadSafeContext are destructed, and providing the
client has not held on to a copy of shared context pointer, the context will be
automatically destructed.

This scheme is necessary due to the following constraits: (1) We need multiple
contexts for multithreaded compilation (at least one per compile thread plus
one to store any IR not currently being compiled, though one context per module
is simpler). (2) We need to free contexts that are no longer being used so that
the JIT does not leak memory over time. (3) Module lifetimes are not
predictable (modules are compiled as needed depending on the flow of JIT'd
code) so there is no single point where contexts could be reclaimed.

JIT clients not using concurrency can safely use one ThreadSafeContext for all
ThreadSafeModules.

JIT clients who want to be able to compile concurrently should use a different
ThreadSafeContext for each module, or call setCloneToNewContextOnEmit on their
top-level IRLayer. The former reduces compile latency (since no clone step is
needed) at the cost of additional memory overhead for uncompiled modules (as
every uncompiled module will duplicate the LLVM types, constants and metadata
that have been shared).

llvm-svn: 343055
2018-09-26 01:24:12 +00:00
..
CMakeLists.txt [ORC] Add unit tests for the new RTDyldObjectLinkingLayer2 class. 2018-08-27 22:30:57 +00:00
CompileOnDemandLayerTest.cpp [ORC] Use JITEvaluatedSymbol for IndirectStubsManager findStub and findPointer. 2018-06-03 02:18:03 +00:00
CoreAPIsTest.cpp [ORC] Add a special 'main' JITDylib that is created on ExecutionSession 2018-09-12 21:48:59 +00:00
GlobalMappingLayerTest.cpp [ORC] Update the GlobalMappingLayer interface to fit the error-ized layer 2017-09-28 02:17:35 +00:00
IndirectionUtilsTest.cpp Re-sort #include lines for unittests. This uses a slightly modified 2017-06-06 11:06:56 +00:00
LazyEmittingLayerTest.cpp [ORC] Start migrating ORC layers to use the new ORC Core.h APIs. 2018-02-06 21:25:11 +00:00
LegacyAPIInteropTest.cpp [ORC] Tidy up JITSymbolFlags to remove the need for some explicit static_casts. 2018-09-02 01:28:26 +00:00
ObjectTransformLayerTest.cpp [ORC] Create a new SymbolStringPool by default in ExecutionSession constructor. 2018-04-02 20:57:56 +00:00
OrcCAPITest.cpp [ORC] Add findSymbolIn() wrapper to C bindings, take #2. 2018-05-24 18:44:34 +00:00
OrcTestCommon.cpp [ORC] Replace SymbolResolvers in the new ORC layers with search orders on VSOs. 2018-07-20 18:31:50 +00:00
OrcTestCommon.h [ORC] Add a special 'main' JITDylib that is created on ExecutionSession 2018-09-12 21:48:59 +00:00
QueueChannel.cpp [Orc] Break QueueChannel out into its own header and add a utility, 2017-04-06 01:49:21 +00:00
QueueChannel.h Re-sort #include lines for unittests. This uses a slightly modified 2017-06-06 11:06:56 +00:00
RemoteObjectLayerTest.cpp [ORC] Switch RTDyldObjectLinkingLayer to take a unique_ptr<MemoryBuffer> rather 2018-02-21 21:55:49 +00:00
RPCUtilsTest.cpp [ORC] Add SerializationTraits for std::set and std::map. 2018-07-30 21:08:06 +00:00
RTDyldObjectLinkingLayer2Test.cpp [ORC] Add ThreadSafeModule and ThreadSafeContext wrappers to support concurrent 2018-09-26 01:24:12 +00:00
RTDyldObjectLinkingLayerTest.cpp Remove some unnecessary constructor arguments. 2018-09-05 20:57:41 +00:00
SymbolStringPoolTest.cpp [ORC] Add dereference operator to SymbolStringPtr. 2018-01-05 00:04:13 +00:00