aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-07 18:33:04 +0000
committerOwen Anderson <resistor@mac.com>2009-07-07 18:33:04 +0000
commita9d1f2c559ef4b2549e29288fe6944e68913ba0f (patch)
tree79e3d7e0aafc4352dafe175986671f4353c0c5e2 /lib/VMCore
parentfd15beefeedcb8108913e75e7c736dfcc17b433a (diff)
downloadexternal_llvm-a9d1f2c559ef4b2549e29288fe6944e68913ba0f.zip
external_llvm-a9d1f2c559ef4b2549e29288fe6944e68913ba0f.tar.gz
external_llvm-a9d1f2c559ef4b2549e29288fe6944e68913ba0f.tar.bz2
Have scoped mutexes take referenes instead of pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74931 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Constants.cpp24
-rw-r--r--lib/VMCore/Function.cpp8
-rw-r--r--lib/VMCore/LeakDetector.cpp6
-rw-r--r--lib/VMCore/Pass.cpp6
-rw-r--r--lib/VMCore/PassManager.cpp4
-rw-r--r--lib/VMCore/Type.cpp14
-rw-r--r--lib/VMCore/TypeSymbolTable.cpp10
-rw-r--r--lib/VMCore/Value.cpp6
8 files changed, 39 insertions, 39 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index a9e4e78..a350031 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -307,7 +307,7 @@ ConstantInt *ConstantInt::get(const APInt& V) {
ConstantsLock->reader_release();
if (!Slot) {
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
ConstantInt *&NewSlot = (*IntConstants)[Key];
if (!Slot) {
NewSlot = new ConstantInt(ITy, V);
@@ -414,7 +414,7 @@ ConstantFP *ConstantFP::get(const APFloat &V) {
ConstantsLock->reader_release();
if (!Slot) {
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
ConstantFP *&NewSlot = (*FPConstants)[Key];
if (!NewSlot) {
const Type *Ty;
@@ -1231,7 +1231,7 @@ public:
/// getOrCreate - Return the specified constant from the map, creating it if
/// necessary.
ConstantClass *getOrCreate(const TypeClass *Ty, const ValType &V) {
- sys::SmartScopedLock<true> Lock(&ValueMapLock);
+ sys::SmartScopedLock<true> Lock(ValueMapLock);
MapKey Lookup(Ty, V);
ConstantClass* Result = 0;
@@ -1249,7 +1249,7 @@ public:
}
void remove(ConstantClass *CP) {
- sys::SmartScopedLock<true> Lock(&ValueMapLock);
+ sys::SmartScopedLock<true> Lock(ValueMapLock);
typename MapTy::iterator I = FindExistingElement(CP);
assert(I != Map.end() && "Constant not found in constant table!");
assert(I->second == CP && "Didn't find correct element?");
@@ -1334,7 +1334,7 @@ public:
}
void refineAbstractType(const DerivedType *OldTy, const Type *NewTy) {
- sys::SmartScopedLock<true> Lock(&ValueMapLock);
+ sys::SmartScopedLock<true> Lock(ValueMapLock);
typename AbstractTypeMapTy::iterator I =
AbstractTypeMap.find(cast<Type>(OldTy));
@@ -1793,7 +1793,7 @@ MDString::MDString(const char *begin, const char *end)
static ManagedStatic<StringMap<MDString*> > MDStringCache;
MDString *MDString::get(const char *StrBegin, const char *StrEnd) {
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
StringMapEntry<MDString *> &Entry = MDStringCache->GetOrCreateValue(
StrBegin, StrEnd);
MDString *&S = Entry.getValue();
@@ -1804,7 +1804,7 @@ MDString *MDString::get(const char *StrBegin, const char *StrEnd) {
}
MDString *MDString::get(const std::string &Str) {
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
StringMapEntry<MDString *> &Entry = MDStringCache->GetOrCreateValue(
Str.data(), Str.data() + Str.size());
MDString *&S = Entry.getValue();
@@ -1815,7 +1815,7 @@ MDString *MDString::get(const std::string &Str) {
}
void MDString::destroyConstant() {
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
MDStringCache->erase(MDStringCache->find(StrBegin, StrEnd));
destroyConstantImpl();
}
@@ -1847,7 +1847,7 @@ MDNode *MDNode::get(Value*const* Vals, unsigned NumVals) {
ConstantsLock->reader_release();
if (!N) {
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
N = MDNodeSet->FindNodeOrInsertPos(ID, InsertPoint);
if (!N) {
// InsertPoint will have been set by the FindNodeOrInsertPos call.
@@ -1859,7 +1859,7 @@ MDNode *MDNode::get(Value*const* Vals, unsigned NumVals) {
}
void MDNode::destroyConstant() {
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
MDNodeSet->RemoveNode(this);
destroyConstantImpl();
@@ -2790,7 +2790,7 @@ void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
Replacement = ConstantAggregateZero::get(getType());
} else {
// Check to see if we have this array type already.
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
bool Exists;
ArrayConstantsTy::MapTy::iterator I =
ArrayConstants->InsertOrGetItem(Lookup, Exists);
@@ -2866,7 +2866,7 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
Replacement = ConstantAggregateZero::get(getType());
} else {
// Check to see if we have this array type already.
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
bool Exists;
StructConstantsTy::MapTy::iterator I =
StructConstants->InsertOrGetItem(Lookup, Exists);
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index a259335..08acc5f 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -242,18 +242,18 @@ static StringPool *GCNamePool;
static ManagedStatic<sys::SmartRWMutex<true> > GCLock;
bool Function::hasGC() const {
- sys::SmartScopedReader<true> Reader(&*GCLock);
+ sys::SmartScopedReader<true> Reader(*GCLock);
return GCNames && GCNames->count(this);
}
const char *Function::getGC() const {
assert(hasGC() && "Function has no collector");
- sys::SmartScopedReader<true> Reader(&*GCLock);
+ sys::SmartScopedReader<true> Reader(*GCLock);
return *(*GCNames)[this];
}
void Function::setGC(const char *Str) {
- sys::SmartScopedWriter<true> Writer(&*GCLock);
+ sys::SmartScopedWriter<true> Writer(*GCLock);
if (!GCNamePool)
GCNamePool = new StringPool();
if (!GCNames)
@@ -262,7 +262,7 @@ void Function::setGC(const char *Str) {
}
void Function::clearGC() {
- sys::SmartScopedWriter<true> Writer(&*GCLock);
+ sys::SmartScopedWriter<true> Writer(*GCLock);
if (GCNames) {
GCNames->erase(this);
if (GCNames->empty()) {
diff --git a/lib/VMCore/LeakDetector.cpp b/lib/VMCore/LeakDetector.cpp
index b5926bc..a6be1af 100644
--- a/lib/VMCore/LeakDetector.cpp
+++ b/lib/VMCore/LeakDetector.cpp
@@ -54,7 +54,7 @@ namespace {
// immediately, it is added to the CachedValue Value. If it is
// immediately removed, no set search need be performed.
void addGarbage(const T* o) {
- sys::SmartScopedWriter<true> Writer(&*LeakDetectorLock);
+ sys::SmartScopedWriter<true> Writer(*LeakDetectorLock);
if (Cache) {
assert(Ts.count(Cache) == 0 && "Object already in set!");
Ts.insert(Cache);
@@ -63,7 +63,7 @@ namespace {
}
void removeGarbage(const T* o) {
- sys::SmartScopedWriter<true> Writer(&*LeakDetectorLock);
+ sys::SmartScopedWriter<true> Writer(*LeakDetectorLock);
if (o == Cache)
Cache = 0; // Cache hit
else
@@ -73,7 +73,7 @@ namespace {
bool hasGarbage(const std::string& Message) {
addGarbage(0); // Flush the Cache
- sys::SmartScopedReader<true> Reader(&*LeakDetectorLock);
+ sys::SmartScopedReader<true> Reader(*LeakDetectorLock);
assert(Cache == 0 && "No value should be cached anymore!");
if (!Ts.empty()) {
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp
index b037994..d82389d 100644
--- a/lib/VMCore/Pass.cpp
+++ b/lib/VMCore/Pass.cpp
@@ -233,7 +233,7 @@ void PassInfo::registerPass() {
getPassRegistrar()->RegisterPass(*this);
// Notify any listeners.
- sys::SmartScopedLock<true> Lock(&ListenersLock);
+ sys::SmartScopedLock<true> Lock(ListenersLock);
if (Listeners)
for (std::vector<PassRegistrationListener*>::iterator
I = Listeners->begin(), E = Listeners->end(); I != E; ++I)
@@ -286,14 +286,14 @@ RegisterAGBase::RegisterAGBase(const char *Name, intptr_t InterfaceID,
// PassRegistrationListener ctor - Add the current object to the list of
// PassRegistrationListeners...
PassRegistrationListener::PassRegistrationListener() {
- sys::SmartScopedLock<true> Lock(&ListenersLock);
+ sys::SmartScopedLock<true> Lock(ListenersLock);
if (!Listeners) Listeners = new std::vector<PassRegistrationListener*>();
Listeners->push_back(this);
}
// dtor - Remove object from list of listeners...
PassRegistrationListener::~PassRegistrationListener() {
- sys::SmartScopedLock<true> Lock(&ListenersLock);
+ sys::SmartScopedLock<true> Lock(ListenersLock);
std::vector<PassRegistrationListener*>::iterator I =
std::find(Listeners->begin(), Listeners->end(), this);
assert(Listeners && I != Listeners->end() &&
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index 46f1243..74c09fd 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -392,7 +392,7 @@ public:
if (dynamic_cast<PMDataManager *>(P))
return;
- sys::SmartScopedLock<true> Lock(&*TimingInfoMutex);
+ sys::SmartScopedLock<true> Lock(*TimingInfoMutex);
std::map<Pass*, Timer>::iterator I = TimingData.find(P);
if (I == TimingData.end())
I=TimingData.insert(std::make_pair(P, Timer(P->getPassName(), TG))).first;
@@ -403,7 +403,7 @@ public:
if (dynamic_cast<PMDataManager *>(P))
return;
- sys::SmartScopedLock<true> Lock(&*TimingInfoMutex);
+ sys::SmartScopedLock<true> Lock(*TimingInfoMutex);
std::map<Pass*, Timer>::iterator I = TimingData.find(P);
assert(I != TimingData.end() && "passStarted/passEnded not nested right!");
I->second.stopTimer();
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 40d7517..b415251 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -1006,7 +1006,7 @@ const IntegerType *IntegerType::get(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(*TypeMapLock);
ITy = IntegerTypes->get(IVT);
if (!ITy) {
@@ -1079,7 +1079,7 @@ FunctionType *FunctionType::get(const Type *ReturnType,
FunctionValType VT(ReturnType, Params, isVarArg);
FunctionType *FT = 0;
- sys::SmartScopedLock<true> L(&*TypeMapLock);
+ sys::SmartScopedLock<true> L(*TypeMapLock);
FT = FunctionTypes->get(VT);
if (!FT) {
@@ -1129,7 +1129,7 @@ ArrayType *ArrayType::get(const Type *ElementType, uint64_t NumElements) {
ArrayValType AVT(ElementType, NumElements);
ArrayType *AT = 0;
- sys::SmartScopedLock<true> L(&*TypeMapLock);
+ sys::SmartScopedLock<true> L(*TypeMapLock);
AT = ArrayTypes->get(AVT);
if (!AT) {
@@ -1188,7 +1188,7 @@ VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) {
VectorValType PVT(ElementType, NumElements);
VectorType *PT = 0;
- sys::SmartScopedLock<true> L(&*TypeMapLock);
+ sys::SmartScopedLock<true> L(*TypeMapLock);
PT = VectorTypes->get(PVT);
if (!PT) {
@@ -1250,7 +1250,7 @@ StructType *StructType::get(const std::vector<const Type*> &ETypes,
StructValType STV(ETypes, isPacked);
StructType *ST = 0;
- sys::SmartScopedLock<true> L(&*TypeMapLock);
+ sys::SmartScopedLock<true> L(*TypeMapLock);
ST = StructTypes->get(STV);
if (!ST) {
@@ -1329,7 +1329,7 @@ PointerType *PointerType::get(const Type *ValueType, unsigned AddressSpace) {
PointerType *PT = 0;
- sys::SmartScopedLock<true> L(&*TypeMapLock);
+ sys::SmartScopedLock<true> L(*TypeMapLock);
PT = PointerTypes->get(PVT);
if (!PT) {
@@ -1488,7 +1488,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(*TypeMapLock);
unlockedRefineAbstractTypeTo(NewType);
}
diff --git a/lib/VMCore/TypeSymbolTable.cpp b/lib/VMCore/TypeSymbolTable.cpp
index 5ae60e2..54da809 100644
--- a/lib/VMCore/TypeSymbolTable.cpp
+++ b/lib/VMCore/TypeSymbolTable.cpp
@@ -37,7 +37,7 @@ TypeSymbolTable::~TypeSymbolTable() {
std::string TypeSymbolTable::getUniqueName(const std::string &BaseName) const {
std::string TryName = BaseName;
- sys::SmartScopedReader<true> Reader(&*TypeSymbolTableLock);
+ sys::SmartScopedReader<true> Reader(*TypeSymbolTableLock);
const_iterator End = tmap.end();
@@ -49,7 +49,7 @@ std::string TypeSymbolTable::getUniqueName(const std::string &BaseName) const {
// lookup a type by name - returns null on failure
Type* TypeSymbolTable::lookup(const std::string& Name) const {
- sys::SmartScopedReader<true> Reader(&*TypeSymbolTableLock);
+ sys::SmartScopedReader<true> Reader(*TypeSymbolTableLock);
const_iterator TI = tmap.find(Name);
Type* result = 0;
@@ -134,7 +134,7 @@ void TypeSymbolTable::insert(const std::string& Name, const Type* T) {
// This function is called when one of the types in the type plane are refined
void TypeSymbolTable::refineAbstractType(const DerivedType *OldType,
const Type *NewType) {
- sys::SmartScopedReader<true> Reader(&*TypeSymbolTableLock);
+ sys::SmartScopedReader<true> Reader(*TypeSymbolTableLock);
// Loop over all of the types in the symbol table, replacing any references
// to OldType with references to NewType. Note that there may be multiple
@@ -165,7 +165,7 @@ void TypeSymbolTable::typeBecameConcrete(const DerivedType *AbsTy) {
// Loop over all of the types in the symbol table, dropping any abstract
// type user entries for AbsTy which occur because there are names for the
// type.
- sys::SmartScopedReader<true> Reader(&*TypeSymbolTableLock);
+ sys::SmartScopedReader<true> Reader(*TypeSymbolTableLock);
for (iterator TI = begin(), TE = end(); TI != TE; ++TI)
if (TI->second == const_cast<Type*>(static_cast<const Type*>(AbsTy)))
AbsTy->removeAbstractTypeUser(this);
@@ -179,7 +179,7 @@ static void DumpTypes(const std::pair<const std::string, const Type*>& T ) {
void TypeSymbolTable::dump() const {
cerr << "TypeSymbolPlane: ";
- sys::SmartScopedReader<true> Reader(&*TypeSymbolTableLock);
+ sys::SmartScopedReader<true> Reader(*TypeSymbolTableLock);
for_each(tmap.begin(), tmap.end(), DumpTypes);
}
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index c952b78..e980a5d 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -430,7 +430,7 @@ void ValueHandleBase::AddToUseList() {
if (VP->HasValueHandle) {
// If this value already has a ValueHandle, then it must be in the
// ValueHandles map already.
- sys::SmartScopedReader<true> Reader(&*ValueHandlesLock);
+ sys::SmartScopedReader<true> Reader(*ValueHandlesLock);
ValueHandleBase *&Entry = (*ValueHandles)[VP];
assert(Entry != 0 && "Value doesn't have any handles?");
AddToExistingUseList(&Entry);
@@ -442,7 +442,7 @@ void ValueHandleBase::AddToUseList() {
// reallocate itself, which would invalidate all of the PrevP pointers that
// point into the old table. Handle this by checking for reallocation and
// updating the stale pointers only if needed.
- sys::SmartScopedWriter<true> Writer(&*ValueHandlesLock);
+ sys::SmartScopedWriter<true> Writer(*ValueHandlesLock);
ValueHandlesTy &Handles = *ValueHandles;
const void *OldBucketPtr = Handles.getPointerIntoBucketsArray();
@@ -484,7 +484,7 @@ void ValueHandleBase::RemoveFromUseList() {
// If the Next pointer was null, then it is possible that this was the last
// ValueHandle watching VP. If so, delete its entry from the ValueHandles
// map.
- sys::SmartScopedWriter<true> Writer(&*ValueHandlesLock);
+ sys::SmartScopedWriter<true> Writer(*ValueHandlesLock);
ValueHandlesTy &Handles = *ValueHandles;
if (Handles.isPointerIntoBucketsArray(PrevPtr)) {
Handles.erase(VP);