[llvm-commits] [llvm] r114046 - /llvm/trunk/lib/VMCore/Attributes.cpp

Owen Anderson resistor at mac.com
Wed Sep 15 17:27:35 PDT 2010


Author: resistor
Date: Wed Sep 15 19:27:35 2010
New Revision: 114046

URL: http://llvm.org/viewvc/llvm-project?rev=114046&view=rev
Log:
Fix a threaded LLVM bug due the need for operator= on reference counted AttrListImpl's.  It might
be possible to implement this very carefully to allow a lock-free implementation while still
avoiding illegal interleavings, but I haven't been able to figure one out.

Modified:
    llvm/trunk/lib/VMCore/Attributes.cpp

Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=114046&r1=114045&r2=114046&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Wed Sep 15 19:27:35 2010
@@ -195,6 +195,7 @@
 }
 
 const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
+  sys::SmartScopedLock<true> Lock(*ALMutex);
   if (AttrList == RHS.AttrList) return *this;
   if (AttrList) AttrList->DropRef();
   AttrList = RHS.AttrList;





More information about the llvm-commits mailing list