1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/unittests
Lang Hames a6587cc70d [ORC] Change the locking scheme for ThreadSafeModule.
ThreadSafeModule/ThreadSafeContext are used to manage lifetimes and locking
for LLVMContexts in ORCv2. Prior to this patch contexts were locked as soon
as an associated Module was emitted (to be compiled and linked), and were not
unlocked until the emit call returned. This could lead to deadlocks if
interdependent modules that shared contexts were compiled on different threads:
when, during emission of the first module, the dependence was discovered the
second module (which would provide the required symbol) could not be emitted as
the thread emitting the first module still held the lock.

This patch eliminates this possibility by moving to a finer-grained locking
scheme. Each client holds the module lock only while they are actively operating
on it. To make this finer grained locking simpler/safer to implement this patch
removes the explicit lock method, 'getContextLock', from ThreadSafeModule and
replaces it with a new method, 'withModuleDo', that implicitly locks the context,
calls a user-supplied function object to operate on the Module, then implicitly
unlocks the context before returning the result.

ThreadSafeModule TSM = getModule(...);
size_t NumFunctions = TSM.withModuleDo(
    [](Module &M) { // <- context locked before entry to lambda.
      return M.size();
    });

Existing ORCv2 layers that operate on ThreadSafeModules are updated to use the
new method.

This method is used to introduce Module locking into each of the existing
layers.

llvm-svn: 367686
2019-08-02 15:21:37 +00:00
..
ADT Add support for openSUSE RISC-V triple 2019-08-01 14:23:56 +00:00
Analysis [AliasAnalysis] Initialize a member variable that may be used by unit test. 2019-08-02 08:05:14 +00:00
AsmParser Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BinaryFormat [YAMLIO] Remove trailing spaces when outputting maps 2019-07-12 04:51:31 +00:00
Bitcode [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
Bitstream [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
CodeGen GlobalISel: Fix widenScalar for G_MERGE_VALUES to pointer 2019-08-01 18:13:16 +00:00
DebugInfo Silence a conversion warning after r366887. NFC 2019-07-24 14:15:02 +00:00
Demangle Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
ExecutionEngine [ORC] Change the locking scheme for ThreadSafeModule. 2019-08-02 15:21:37 +00:00
FuzzMutate Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IR [IR] Add getArg() method to Function class 2019-08-01 15:31:40 +00:00
LineEditor Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Linker [opaque pointer types] Pass value type to LoadInst creation. 2019-02-01 20:44:24 +00:00
MC Change some StringRef::data() reinterpret_cast to bytes_begin() or arrayRefFromStringRef() 2019-04-07 03:58:42 +00:00
MI MachineModuleInfo: Store more specific reference to LLVMTargetMachine; NFC 2018-11-05 23:49:13 +00:00
Object Minidump: Add support for the MemoryList stream 2019-05-16 15:17:30 +00:00
ObjectYAML Minidump: Add support for reading/writing strings 2019-04-05 08:06:26 +00:00
Option Option spell checking: Penalize delimiter flags if input has no argument 2019-05-01 16:45:15 +00:00
Passes Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ProfileData [Profile] Support raw/indexed profiles larger than 4GB 2019-07-09 22:01:04 +00:00
Remarks Reland: [Remarks] Add an LLVM-bitstream-based remark serializer 2019-07-31 00:13:51 +00:00
Support [LLVM][Alignment] Fix AlignmentTest on platform where size_t != uint64_t 2019-08-01 09:20:00 +00:00
Target [WebAssembly] Rename except_ref type to exnref 2019-07-15 22:49:25 +00:00
TextAPI [YAMLIO] Remove trailing spaces when outputting maps 2019-07-12 04:51:31 +00:00
tools Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
Transforms [MemorySSA] Set LoopSimplify to preserve MemorySSA in the NPM, if analysis exists. 2019-08-01 18:28:28 +00:00
XRay Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
unittest.cfg.in Add support for unittest inputs. 2018-09-05 23:30:17 +00:00