[llvm-commits] [llvm] r74931 - in /llvm/trunk: include/llvm/System/ lib/CodeGen/SelectionDAG/ lib/CompilerDriver/ lib/ExecutionEngine/Interpreter/ lib/Support/ lib/Target/ lib/VMCore/
Owen Anderson
resistor at mac.com
Tue Jul 7 11:33:05 PDT 2009
Author: resistor
Date: Tue Jul 7 13:33:04 2009
New Revision: 74931
URL: http://llvm.org/viewvc/llvm-project?rev=74931&view=rev
Log:
Have scoped mutexes take referenes instead of pointers.
Modified:
llvm/trunk/include/llvm/System/Mutex.h
llvm/trunk/include/llvm/System/RWMutex.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/CompilerDriver/Plugin.cpp
llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
llvm/trunk/lib/Support/Annotation.cpp
llvm/trunk/lib/Support/PluginLoader.cpp
llvm/trunk/lib/Support/Statistic.cpp
llvm/trunk/lib/Support/Timer.cpp
llvm/trunk/lib/Target/TargetData.cpp
llvm/trunk/lib/VMCore/Constants.cpp
llvm/trunk/lib/VMCore/Function.cpp
llvm/trunk/lib/VMCore/LeakDetector.cpp
llvm/trunk/lib/VMCore/Pass.cpp
llvm/trunk/lib/VMCore/PassManager.cpp
llvm/trunk/lib/VMCore/Type.cpp
llvm/trunk/lib/VMCore/TypeSymbolTable.cpp
llvm/trunk/lib/VMCore/Value.cpp
Modified: llvm/trunk/include/llvm/System/Mutex.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Mutex.h?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Mutex.h (original)
+++ llvm/trunk/include/llvm/System/Mutex.h Tue Jul 7 13:33:04 2009
@@ -131,15 +131,15 @@
template<bool mt_only>
class SmartScopedLock {
- SmartMutex<mt_only>* mtx;
+ SmartMutex<mt_only>& mtx;
public:
- SmartScopedLock(SmartMutex<mt_only>* m) : mtx(m) {
- mtx->acquire();
+ SmartScopedLock(SmartMutex<mt_only>& m) : mtx(m) {
+ mtx.acquire();
}
~SmartScopedLock() {
- mtx->release();
+ mtx.release();
}
};
Modified: llvm/trunk/include/llvm/System/RWMutex.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/RWMutex.h?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/RWMutex.h (original)
+++ llvm/trunk/include/llvm/System/RWMutex.h Tue Jul 7 13:33:04 2009
@@ -141,15 +141,14 @@
/// ScopedReader - RAII acquisition of a reader lock
template<bool mt_only>
struct SmartScopedReader {
- SmartRWMutex<mt_only>* mutex;
+ SmartRWMutex<mt_only>& mutex;
- explicit SmartScopedReader(SmartRWMutex<mt_only>* m) {
- mutex = m;
- mutex->reader_acquire();
+ explicit SmartScopedReader(SmartRWMutex<mt_only>& m) : mutex(m) {
+ mutex.reader_acquire();
}
~SmartScopedReader() {
- mutex->reader_release();
+ mutex.reader_release();
}
};
typedef SmartScopedReader<false> ScopedReader;
@@ -157,15 +156,14 @@
/// ScopedWriter - RAII acquisition of a writer lock
template<bool mt_only>
struct SmartScopedWriter {
- SmartRWMutex<mt_only>* mutex;
+ SmartRWMutex<mt_only>& mutex;
- explicit SmartScopedWriter(SmartRWMutex<mt_only>* m) {
- mutex = m;
- mutex->writer_acquire();
+ explicit SmartScopedWriter(SmartRWMutex<mt_only>& m) : mutex(m) {
+ mutex.writer_acquire();
}
~SmartScopedWriter() {
- mutex->writer_release();
+ mutex.writer_release();
}
};
typedef SmartScopedWriter<false> ScopedWriter;
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Jul 7 13:33:04 2009
@@ -5010,7 +5010,7 @@
/// getValueTypeList - Return a pointer to the specified value type.
///
const MVT *SDNode::getValueTypeList(MVT VT) {
- sys::SmartScopedLock<true> Lock(&*VTMutex);
+ sys::SmartScopedLock<true> Lock(*VTMutex);
if (VT.isExtended()) {
return &(*EVTs->insert(VT).first);
} else {
Modified: llvm/trunk/lib/CompilerDriver/Plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Plugin.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Plugin.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Plugin.cpp Tue Jul 7 13:33:04 2009
@@ -42,7 +42,7 @@
namespace llvmc {
PluginLoader::PluginLoader() {
- llvm::sys::SmartScopedLock<true> Lock(&*PluginMutex);
+ llvm::sys::SmartScopedLock<true> Lock(*PluginMutex);
if (!pluginListInitialized) {
for (PluginRegistry::iterator B = PluginRegistry::begin(),
E = PluginRegistry::end(); B != E; ++B)
@@ -53,7 +53,7 @@
}
PluginLoader::~PluginLoader() {
- llvm::sys::SmartScopedLock<true> Lock(&*PluginMutex);
+ llvm::sys::SmartScopedLock<true> Lock(*PluginMutex);
if (pluginListInitialized) {
for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
B != E; ++B)
@@ -63,14 +63,14 @@
}
void PluginLoader::PopulateLanguageMap(LanguageMap& langMap) {
- llvm::sys::SmartScopedLock<true> Lock(&*PluginMutex);
+ llvm::sys::SmartScopedLock<true> Lock(*PluginMutex);
for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
B != E; ++B)
(*B)->PopulateLanguageMap(langMap);
}
void PluginLoader::PopulateCompilationGraph(CompilationGraph& graph) {
- llvm::sys::SmartScopedLock<true> Lock(&*PluginMutex);
+ llvm::sys::SmartScopedLock<true> Lock(*PluginMutex);
for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
B != E; ++B)
(*B)->PopulateCompilationGraph(graph);
Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Tue Jul 7 13:33:04 2009
@@ -97,7 +97,7 @@
ExtName += getTypeID(FT->getContainedType(i));
ExtName += "_" + F->getName();
- sys::ScopedLock Writer(&*FunctionsLock);
+ sys::ScopedLock Writer(*FunctionsLock);
ExFunc FnPtr = FuncNames[ExtName];
if (FnPtr == 0)
FnPtr = FuncNames["lle_X_"+F->getName()];
@@ -539,7 +539,7 @@
void Interpreter::initializeExternalFunctions() {
- sys::ScopedLock Writer(&*FunctionsLock);
+ sys::ScopedLock Writer(*FunctionsLock);
FuncNames["lle_X_atexit"] = lle_X_atexit;
FuncNames["lle_X_exit"] = lle_X_exit;
FuncNames["lle_X_abort"] = lle_X_abort;
Modified: llvm/trunk/lib/Support/Annotation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Annotation.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Annotation.cpp (original)
+++ llvm/trunk/lib/Support/Annotation.cpp Tue Jul 7 13:33:04 2009
@@ -55,7 +55,7 @@
}
static void eraseFromFactMap(unsigned ID) {
- sys::SmartScopedWriter<true> Writer(&*AnnotationsLock);
+ sys::SmartScopedWriter<true> Writer(*AnnotationsLock);
TheFactMap->erase(ID);
}
@@ -66,7 +66,7 @@
AnnotationsLock->reader_release();
if (I == E) {
- sys::SmartScopedWriter<true> Writer(&*AnnotationsLock);
+ sys::SmartScopedWriter<true> Writer(*AnnotationsLock);
I = IDMap->find(Name);
if (I == IDMap->end()) {
unsigned newCount = sys::AtomicIncrement(&IDCounter);
@@ -91,7 +91,7 @@
// only be used for debugging.
//
const char *AnnotationManager::getName(AnnotationID ID) { // ID -> Name
- sys::SmartScopedReader<true> Reader(&*AnnotationsLock);
+ sys::SmartScopedReader<true> Reader(*AnnotationsLock);
IDMapType &TheMap = *IDMap;
for (IDMapType::iterator I = TheMap.begin(); ; ++I) {
assert(I != TheMap.end() && "Annotation ID is unknown!");
@@ -106,7 +106,7 @@
void AnnotationManager::registerAnnotationFactory(AnnotationID ID, AnnFactory F,
void *ExtraData) {
if (F) {
- sys::SmartScopedWriter<true> Writer(&*AnnotationsLock);
+ sys::SmartScopedWriter<true> Writer(*AnnotationsLock);
getFactMap()[ID.ID] = std::make_pair(F, ExtraData);
} else {
eraseFromFactMap(ID.ID);
Modified: llvm/trunk/lib/Support/PluginLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PluginLoader.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/Support/PluginLoader.cpp (original)
+++ llvm/trunk/lib/Support/PluginLoader.cpp Tue Jul 7 13:33:04 2009
@@ -25,7 +25,7 @@
static ManagedStatic<sys::SmartMutex<true> > PluginsLock;
void PluginLoader::operator=(const std::string &Filename) {
- sys::SmartScopedLock<true> Lock(&*PluginsLock);
+ sys::SmartScopedLock<true> Lock(*PluginsLock);
std::string Error;
if (sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str(), &Error)) {
cerr << "Error opening '" << Filename << "': " << Error
@@ -36,12 +36,12 @@
}
unsigned PluginLoader::getNumPlugins() {
- sys::SmartScopedLock<true> Lock(&*PluginsLock);
+ sys::SmartScopedLock<true> Lock(*PluginsLock);
return Plugins.isConstructed() ? Plugins->size() : 0;
}
std::string &PluginLoader::getPlugin(unsigned num) {
- sys::SmartScopedLock<true> Lock(&*PluginsLock);
+ sys::SmartScopedLock<true> Lock(*PluginsLock);
assert(Plugins.isConstructed() && num < Plugins->size() &&
"Asking for an out of bounds plugin");
return (*Plugins)[num];
Modified: llvm/trunk/lib/Support/Statistic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Statistic.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Statistic.cpp (original)
+++ llvm/trunk/lib/Support/Statistic.cpp Tue Jul 7 13:33:04 2009
@@ -65,7 +65,7 @@
void Statistic::RegisterStatistic() {
// If stats are enabled, inform StatInfo that this statistic should be
// printed.
- sys::ScopedLock Writer(&*StatLock);
+ sys::ScopedLock Writer(*StatLock);
if (!Initialized) {
if (Enabled)
StatInfo->addStatistic(this);
Modified: llvm/trunk/lib/Support/Timer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Timer.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Timer.cpp (original)
+++ llvm/trunk/lib/Support/Timer.cpp Tue Jul 7 13:33:04 2009
@@ -145,7 +145,7 @@
static ManagedStatic<std::vector<Timer*> > ActiveTimers;
void Timer::startTimer() {
- sys::SmartScopedLock<true> L(&Lock);
+ sys::SmartScopedLock<true> L(Lock);
Started = true;
ActiveTimers->push_back(this);
TimeRecord TR = getTimeRecord(true);
@@ -157,7 +157,7 @@
}
void Timer::stopTimer() {
- sys::SmartScopedLock<true> L(&Lock);
+ sys::SmartScopedLock<true> L(Lock);
TimeRecord TR = getTimeRecord(false);
Elapsed += TR.Elapsed;
UserTime += TR.UserTime;
@@ -229,7 +229,7 @@
static ManagedStatic<Name2Pair> NamedGroupedTimers;
static Timer &getNamedRegionTimer(const std::string &Name) {
- sys::SmartScopedLock<true> L(&*TimerLock);
+ sys::SmartScopedLock<true> L(*TimerLock);
Name2Timer::iterator I = NamedTimers->find(Name);
if (I != NamedTimers->end())
return I->second;
@@ -239,7 +239,7 @@
static Timer &getNamedRegionTimer(const std::string &Name,
const std::string &GroupName) {
- sys::SmartScopedLock<true> L(&*TimerLock);
+ sys::SmartScopedLock<true> L(*TimerLock);
Name2Pair::iterator I = NamedGroupedTimers->find(GroupName);
if (I == NamedGroupedTimers->end()) {
@@ -365,7 +365,7 @@
void TimerGroup::removeTimer() {
- sys::SmartScopedLock<true> L(&*TimerLock);
+ sys::SmartScopedLock<true> L(*TimerLock);
if (--NumTimers == 0 && !TimersToPrint.empty()) { // Print timing report...
// Sort the timers in descending order by amount of time taken...
std::sort(TimersToPrint.begin(), TimersToPrint.end(),
@@ -434,12 +434,12 @@
}
void TimerGroup::addTimer() {
- sys::SmartScopedLock<true> L(&*TimerLock);
+ sys::SmartScopedLock<true> L(*TimerLock);
++NumTimers;
}
void TimerGroup::addTimerToPrint(const Timer &T) {
- sys::SmartScopedLock<true> L(&*TimerLock);
+ sys::SmartScopedLock<true> L(*TimerLock);
TimersToPrint.push_back(Timer(true, T));
}
Modified: llvm/trunk/lib/Target/TargetData.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetData.cpp (original)
+++ llvm/trunk/lib/Target/TargetData.cpp Tue Jul 7 13:33:04 2009
@@ -352,7 +352,7 @@
if (!LayoutInfo.isConstructed())
return;
- sys::SmartScopedLock<true> Lock(&*LayoutLock);
+ sys::SmartScopedLock<true> Lock(*LayoutLock);
// Remove any layouts for this TD.
LayoutInfoTy &TheMap = *LayoutInfo;
for (LayoutInfoTy::iterator I = TheMap.begin(), E = TheMap.end(); I != E; ) {
@@ -369,7 +369,7 @@
const StructLayout *TargetData::getStructLayout(const StructType *Ty) const {
LayoutInfoTy &TheMap = *LayoutInfo;
- sys::SmartScopedLock<true> Lock(&*LayoutLock);
+ sys::SmartScopedLock<true> Lock(*LayoutLock);
StructLayout *&SL = TheMap[LayoutKey(this, Ty)];
if (SL) return SL;
@@ -394,7 +394,7 @@
void TargetData::InvalidateStructLayoutInfo(const StructType *Ty) const {
if (!LayoutInfo.isConstructed()) return; // No cache.
- sys::SmartScopedLock<true> Lock(&*LayoutLock);
+ sys::SmartScopedLock<true> Lock(*LayoutLock);
LayoutInfoTy::iterator I = LayoutInfo->find(LayoutKey(this, Ty));
if (I == LayoutInfo->end()) return;
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jul 7 13:33:04 2009
@@ -307,7 +307,7 @@
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 @@
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 @@
/// 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 @@
}
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 @@
}
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 @@
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 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 @@
}
void MDString::destroyConstant() {
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
MDStringCache->erase(MDStringCache->find(StrBegin, StrEnd));
destroyConstantImpl();
}
@@ -1847,7 +1847,7 @@
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 @@
}
void MDNode::destroyConstant() {
- sys::SmartScopedWriter<true> Writer(&*ConstantsLock);
+ sys::SmartScopedWriter<true> Writer(*ConstantsLock);
MDNodeSet->RemoveNode(this);
destroyConstantImpl();
@@ -2790,7 +2790,7 @@
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 @@
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);
Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Tue Jul 7 13:33:04 2009
@@ -242,18 +242,18 @@
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::clearGC() {
- sys::SmartScopedWriter<true> Writer(&*GCLock);
+ sys::SmartScopedWriter<true> Writer(*GCLock);
if (GCNames) {
GCNames->erase(this);
if (GCNames->empty()) {
Modified: llvm/trunk/lib/VMCore/LeakDetector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LeakDetector.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/LeakDetector.cpp (original)
+++ llvm/trunk/lib/VMCore/LeakDetector.cpp Tue Jul 7 13:33:04 2009
@@ -54,7 +54,7 @@
// 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 @@
}
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 @@
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()) {
Modified: llvm/trunk/lib/VMCore/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Pass.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Pass.cpp (original)
+++ llvm/trunk/lib/VMCore/Pass.cpp Tue Jul 7 13:33:04 2009
@@ -233,7 +233,7 @@
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 @@
// 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() &&
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Tue Jul 7 13:33:04 2009
@@ -392,7 +392,7 @@
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 @@
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();
Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Tue Jul 7 13:33:04 2009
@@ -1006,7 +1006,7 @@
// 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 @@
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 @@
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 @@
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 @@
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 *PT = 0;
- sys::SmartScopedLock<true> L(&*TypeMapLock);
+ sys::SmartScopedLock<true> L(*TypeMapLock);
PT = PointerTypes->get(PVT);
if (!PT) {
@@ -1488,7 +1488,7 @@
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);
}
Modified: llvm/trunk/lib/VMCore/TypeSymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/TypeSymbolTable.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/TypeSymbolTable.cpp (original)
+++ llvm/trunk/lib/VMCore/TypeSymbolTable.cpp Tue Jul 7 13:33:04 2009
@@ -37,7 +37,7 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
void TypeSymbolTable::dump() const {
cerr << "TypeSymbolPlane: ";
- sys::SmartScopedReader<true> Reader(&*TypeSymbolTableLock);
+ sys::SmartScopedReader<true> Reader(*TypeSymbolTableLock);
for_each(tmap.begin(), tmap.end(), DumpTypes);
}
Modified: llvm/trunk/lib/VMCore/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=74931&r1=74930&r2=74931&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Value.cpp (original)
+++ llvm/trunk/lib/VMCore/Value.cpp Tue Jul 7 13:33:04 2009
@@ -430,7 +430,7 @@
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 @@
// 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 @@
// 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);
More information about the llvm-commits
mailing list