summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc/ThreadSafeModuleTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-151-14/+14
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* [ORC] Change the locking scheme for ThreadSafeModule.Lang Hames2019-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [ORC] clang-format the ThreadSafeModule code.Lang Hames2018-09-281-3/+3
| | | | | | Evidently I forgot to do this before committing r343055. llvm-svn: 343288
* Re-reapply r343129 with more fixes.Lang Hames2018-09-271-14/+15
| | | | | | Fixes order-of-operand-evaluation bugs in the ThreadSafeModule unit tests. llvm-svn: 343162
* Revert "Re-revert r343129."Lang Hames2018-09-271-0/+94
| | | | | | This reverts commit 4e2557dbc76704beb8c4cf1191cb786e719db5d3. llvm-svn: 343161
* Re-revert r343129.Lang Hames2018-09-261-94/+0
| | | | | | | Apparently the fixes in r343149 did not cover all the issues. Re-reverting while I investigate. llvm-svn: 343151
* Reapply r343129 with fix.Lang Hames2018-09-261-0/+94
| | | | | | | | Explicitly defines ThreadSafeModule's move-assignment operator to move fields in reverse order. This is required to ensure that the context field outlives the module field. llvm-svn: 343149
* Revert r343129 "[ORC] Change the field order of ThreadSafeModule to ensure the "Lang Hames2018-09-261-84/+0
| | | | | | It broke several bots. llvm-svn: 343133
* [ORC] Change the field order of ThreadSafeModule to ensure the Module isLang Hames2018-09-261-0/+84
destroyed before its ThreadSharedContext. Destroying the context first is an error if this ThreadSafeModule is the only owner of its underlying context. Add a unit test for ThreadSafeModule/ThreadSafeContext to catch this and other basic usage issues. llvm-svn: 343129
OpenPOWER on IntegriCloud