diff options
author | Owen Anderson <resistor@mac.com> | 2009-08-17 17:34:27 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-08-17 17:34:27 +0000 |
commit | 36a3eb0aaa6e6981186ca0bc275bc86c2effd743 (patch) | |
tree | 7c1601c27348805db9b8836c528b974cdcfb3a23 /lib/VMCore/Type.cpp | |
parent | 596c1dc3e228795562975396bcd9672840aa3c82 (diff) | |
download | external_llvm-36a3eb0aaa6e6981186ca0bc275bc86c2effd743.zip external_llvm-36a3eb0aaa6e6981186ca0bc275bc86c2effd743.tar.gz external_llvm-36a3eb0aaa6e6981186ca0bc275bc86c2effd743.tar.bz2 |
Move the TypeMap lock to a member on LLVMContextImpl.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79256 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r-- | lib/VMCore/Type.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 93433a7..3b54f73 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -47,9 +47,6 @@ AbstractTypeUser::~AbstractTypeUser() {} // Type Class Implementation //===----------------------------------------------------------------------===// -// Lock used for guarding access to the type maps. -static ManagedStatic<sys::SmartMutex<true> > TypeMapLock; - // Recursive lock used for guarding access to AbstractTypeUsers. // NOTE: The true template parameter means this will no-op when we're not in // multithreaded mode. @@ -759,7 +756,7 @@ const IntegerType *IntegerType::get(LLVMContext &C, unsigned NumBits) { // First, see if the type is already in the table, for which // a reader lock suffices. - sys::SmartScopedLock<true> L(*TypeMapLock); + sys::SmartScopedLock<true> L(pImpl->TypeMapLock); ITy = pImpl->IntegerTypes.get(IVT); if (!ITy) { @@ -801,7 +798,7 @@ FunctionType *FunctionType::get(const Type *ReturnType, LLVMContextImpl *pImpl = ReturnType->getContext().pImpl; - sys::SmartScopedLock<true> L(*TypeMapLock); + sys::SmartScopedLock<true> L(pImpl->TypeMapLock); FT = pImpl->FunctionTypes.get(VT); if (!FT) { @@ -826,7 +823,7 @@ ArrayType *ArrayType::get(const Type *ElementType, uint64_t NumElements) { LLVMContextImpl *pImpl = ElementType->getContext().pImpl; - sys::SmartScopedLock<true> L(*TypeMapLock); + sys::SmartScopedLock<true> L(pImpl->TypeMapLock); AT = pImpl->ArrayTypes.get(AVT); if (!AT) { @@ -860,7 +857,7 @@ VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) { LLVMContextImpl *pImpl = ElementType->getContext().pImpl; - sys::SmartScopedLock<true> L(*TypeMapLock); + sys::SmartScopedLock<true> L(pImpl->TypeMapLock); PT = pImpl->VectorTypes.get(PVT); if (!PT) { @@ -892,7 +889,7 @@ StructType *StructType::get(LLVMContext &Context, LLVMContextImpl *pImpl = Context.pImpl; - sys::SmartScopedLock<true> L(*TypeMapLock); + sys::SmartScopedLock<true> L(pImpl->TypeMapLock); ST = pImpl->StructTypes.get(STV); if (!ST) { @@ -948,7 +945,7 @@ PointerType *PointerType::get(const Type *ValueType, unsigned AddressSpace) { LLVMContextImpl *pImpl = ValueType->getContext().pImpl; - sys::SmartScopedLock<true> L(*TypeMapLock); + sys::SmartScopedLock<true> L(pImpl->TypeMapLock); PT = pImpl->PointerTypes.get(PVT); if (!PT) { @@ -1108,7 +1105,7 @@ void DerivedType::unlockedRefineAbstractTypeTo(const Type *NewType) { void DerivedType::refineAbstractTypeTo(const Type *NewType) { // All recursive calls will go through unlockedRefineAbstractTypeTo, // to avoid deadlock problems. - sys::SmartScopedLock<true> L(*TypeMapLock); + sys::SmartScopedLock<true> L(NewType->getContext().pImpl->TypeMapLock); unlockedRefineAbstractTypeTo(NewType); } |