[PATCH] D63377: [ORC] Avoid Race in Assertions

Praveen velliengiri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 15 07:35:18 PDT 2019


pree-jackie created this revision.
pree-jackie added reviewers: lhames, dblaikie.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Prevents when two threads execute the assertions and two threads passed the check before any one is acquiring the SessionLock.


https://reviews.llvm.org/D63377

Files:
  llvm/lib/ExecutionEngine/Orc/Core.cpp


Index: llvm/lib/ExecutionEngine/Orc/Core.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -1607,8 +1607,9 @@
 
 JITDylib &ExecutionSession::createJITDylib(std::string Name,
                                            bool AddToMainDylibSearchOrder) {
-  assert(!getJITDylibByName(Name) && "JITDylib with that name already exists");
   return runSessionLocked([&, this]() -> JITDylib & {
+    assert(!getJITDylibByName(Name) &&
+           "JITDylib with that name already exists");
     JDs.push_back(
         std::unique_ptr<JITDylib>(new JITDylib(*this, std::move(Name))));
     if (AddToMainDylibSearchOrder)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63377.204918.patch
Type: text/x-patch
Size: 723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190615/668c294b/attachment.bin>


More information about the llvm-commits mailing list