llvm.org GIT mirror llvm / a9d1f2c
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 Owen Anderson 11 years ago
18 changed file(s) with 76 addition(s) and 78 deletion(s). Raw diff Collapse all Expand all
130130
131131 template
132132 class SmartScopedLock {
133 SmartMutex* mtx;
133 SmartMutex& mtx;
134134
135135 public:
136 SmartScopedLock(SmartMutex* m) : mtx(m) {
137 mtx->acquire();
136 SmartScopedLock(SmartMutex& m) : mtx(m) {
137 mtx.acquire();
138138 }
139139
140140 ~SmartScopedLock() {
141 mtx->release();
141 mtx.release();
142142 }
143143 };
144144
140140 /// ScopedReader - RAII acquisition of a reader lock
141141 template
142142 struct SmartScopedReader {
143 SmartRWMutex* mutex;
143 SmartRWMutex& mutex;
144144
145 explicit SmartScopedReader(SmartRWMutex* m) {
146 mutex = m;
147 mutex->reader_acquire();
145 explicit SmartScopedReader(SmartRWMutex& m) : mutex(m) {
146 mutex.reader_acquire();
148147 }
149148
150149 ~SmartScopedReader() {
151 mutex->reader_release();
150 mutex.reader_release();
152151 }
153152 };
154153 typedef SmartScopedReader ScopedReader;
156155 /// ScopedWriter - RAII acquisition of a writer lock
157156 template
158157 struct SmartScopedWriter {
159 SmartRWMutex* mutex;
158 SmartRWMutex& mutex;
160159
161 explicit SmartScopedWriter(SmartRWMutex* m) {
162 mutex = m;
163 mutex->writer_acquire();
160 explicit SmartScopedWriter(SmartRWMutex& m) : mutex(m) {
161 mutex.writer_acquire();
164162 }
165163
166164 ~SmartScopedWriter() {
167 mutex->writer_release();
165 mutex.writer_release();
168166 }
169167 };
170168 typedef SmartScopedWriter ScopedWriter;
50095009 /// getValueTypeList - Return a pointer to the specified value type.
50105010 ///
50115011 const MVT *SDNode::getValueTypeList(MVT VT) {
5012 sys::SmartScopedLock Lock(&*VTMutex);
5012 sys::SmartScopedLock Lock(*VTMutex);
50135013 if (VT.isExtended()) {
50145014 return &(*EVTs->insert(VT).first);
50155015 } else {
4141 namespace llvmc {
4242
4343 PluginLoader::PluginLoader() {
44 llvm::sys::SmartScopedLock Lock(&*PluginMutex);
44 llvm::sys::SmartScopedLock Lock(*PluginMutex);
4545 if (!pluginListInitialized) {
4646 for (PluginRegistry::iterator B = PluginRegistry::begin(),
4747 E = PluginRegistry::end(); B != E; ++B)
5252 }
5353
5454 PluginLoader::~PluginLoader() {
55 llvm::sys::SmartScopedLock Lock(&*PluginMutex);
55 llvm::sys::SmartScopedLock Lock(*PluginMutex);
5656 if (pluginListInitialized) {
5757 for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
5858 B != E; ++B)
6262 }
6363
6464 void PluginLoader::PopulateLanguageMap(LanguageMap& langMap) {
65 llvm::sys::SmartScopedLock Lock(&*PluginMutex);
65 llvm::sys::SmartScopedLock Lock(*PluginMutex);
6666 for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
6767 B != E; ++B)
6868 (*B)->PopulateLanguageMap(langMap);
6969 }
7070
7171 void PluginLoader::PopulateCompilationGraph(CompilationGraph& graph) {
72 llvm::sys::SmartScopedLock Lock(&*PluginMutex);
72 llvm::sys::SmartScopedLock Lock(*PluginMutex);
7373 for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
7474 B != E; ++B)
7575 (*B)->PopulateCompilationGraph(graph);
9696 ExtName += getTypeID(FT->getContainedType(i));
9797 ExtName += "_" + F->getName();
9898
99 sys::ScopedLock Writer(&*FunctionsLock);
99 sys::ScopedLock Writer(*FunctionsLock);
100100 ExFunc FnPtr = FuncNames[ExtName];
101101 if (FnPtr == 0)
102102 FnPtr = FuncNames["lle_X_"+F->getName()];
538538
539539
540540 void Interpreter::initializeExternalFunctions() {
541 sys::ScopedLock Writer(&*FunctionsLock);
541 sys::ScopedLock Writer(*FunctionsLock);
542542 FuncNames["lle_X_atexit"] = lle_X_atexit;
543543 FuncNames["lle_X_exit"] = lle_X_exit;
544544 FuncNames["lle_X_abort"] = lle_X_abort;
5454 }
5555
5656 static void eraseFromFactMap(unsigned ID) {
57 sys::SmartScopedWriter Writer(&*AnnotationsLock);
57 sys::SmartScopedWriter Writer(*AnnotationsLock);
5858 TheFactMap->erase(ID);
5959 }
6060
6565 AnnotationsLock->reader_release();
6666
6767 if (I == E) {
68 sys::SmartScopedWriter Writer(&*AnnotationsLock);
68 sys::SmartScopedWriter Writer(*AnnotationsLock);
6969 I = IDMap->find(Name);
7070 if (I == IDMap->end()) {
7171 unsigned newCount = sys::AtomicIncrement(&IDCounter);
9090 // only be used for debugging.
9191 //
9292 const char *AnnotationManager::getName(AnnotationID ID) { // ID -> Name
93 sys::SmartScopedReader Reader(&*AnnotationsLock);
93 sys::SmartScopedReader Reader(*AnnotationsLock);
9494 IDMapType &TheMap = *IDMap;
9595 for (IDMapType::iterator I = TheMap.begin(); ; ++I) {
9696 assert(I != TheMap.end() && "Annotation ID is unknown!");
105105 void AnnotationManager::registerAnnotationFactory(AnnotationID ID, AnnFactory F,
106106 void *ExtraData) {
107107 if (F) {
108 sys::SmartScopedWriter Writer(&*AnnotationsLock);
108 sys::SmartScopedWriter Writer(*AnnotationsLock);
109109 getFactMap()[ID.ID] = std::make_pair(F, ExtraData);
110110 } else {
111111 eraseFromFactMap(ID.ID);
2424 static ManagedStatic > PluginsLock;
2525
2626 void PluginLoader::operator=(const std::string &Filename) {
27 sys::SmartScopedLock Lock(&*PluginsLock);
27 sys::SmartScopedLock Lock(*PluginsLock);
2828 std::string Error;
2929 if (sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str(), &Error)) {
3030 cerr << "Error opening '" << Filename << "': " << Error
3535 }
3636
3737 unsigned PluginLoader::getNumPlugins() {
38 sys::SmartScopedLock Lock(&*PluginsLock);
38 sys::SmartScopedLock Lock(*PluginsLock);
3939 return Plugins.isConstructed() ? Plugins->size() : 0;
4040 }
4141
4242 std::string &PluginLoader::getPlugin(unsigned num) {
43 sys::SmartScopedLock Lock(&*PluginsLock);
43 sys::SmartScopedLock Lock(*PluginsLock);
4444 assert(Plugins.isConstructed() && num < Plugins->size() &&
4545 "Asking for an out of bounds plugin");
4646 return (*Plugins)[num];
6464 void Statistic::RegisterStatistic() {
6565 // If stats are enabled, inform StatInfo that this statistic should be
6666 // printed.
67 sys::ScopedLock Writer(&*StatLock);
67 sys::ScopedLock Writer(*StatLock);
6868 if (!Initialized) {
6969 if (Enabled)
7070 StatInfo->addStatistic(this);
144144 static ManagedStatic > ActiveTimers;
145145
146146 void Timer::startTimer() {
147 sys::SmartScopedLock L(&Lock);
147 sys::SmartScopedLock L(Lock);
148148 Started = true;
149149 ActiveTimers->push_back(this);
150150 TimeRecord TR = getTimeRecord(true);
156156 }
157157
158158 void Timer::stopTimer() {
159 sys::SmartScopedLock L(&Lock);
159 sys::SmartScopedLock L(Lock);
160160 TimeRecord TR = getTimeRecord(false);
161161 Elapsed += TR.Elapsed;
162162 UserTime += TR.UserTime;
228228 static ManagedStatic NamedGroupedTimers;
229229
230230 static Timer &getNamedRegionTimer(const std::string &Name) {
231 sys::SmartScopedLock L(&*TimerLock);
231 sys::SmartScopedLock L(*TimerLock);
232232 Name2Timer::iterator I = NamedTimers->find(Name);
233233 if (I != NamedTimers->end())
234234 return I->second;
238238
239239 static Timer &getNamedRegionTimer(const std::string &Name,
240240 const std::string &GroupName) {
241 sys::SmartScopedLock L(&*TimerLock);
241 sys::SmartScopedLock L(*TimerLock);
242242
243243 Name2Pair::iterator I = NamedGroupedTimers->find(GroupName);
244244 if (I == NamedGroupedTimers->end()) {
364364
365365
366366 void TimerGroup::removeTimer() {
367 sys::SmartScopedLock L(&*TimerLock);
367 sys::SmartScopedLock L(*TimerLock);
368368 if (--NumTimers == 0 && !TimersToPrint.empty()) { // Print timing report...
369369 // Sort the timers in descending order by amount of time taken...
370370 std::sort(TimersToPrint.begin(), TimersToPrint.end(),
433433 }
434434
435435 void TimerGroup::addTimer() {
436 sys::SmartScopedLock L(&*TimerLock);
436 sys::SmartScopedLock L(*TimerLock);
437437 ++NumTimers;
438438 }
439439
440440 void TimerGroup::addTimerToPrint(const Timer &T) {
441 sys::SmartScopedLock L(&*TimerLock);
441 sys::SmartScopedLock L(*TimerLock);
442442 TimersToPrint.push_back(Timer(true, T));
443443 }
444444
351351 if (!LayoutInfo.isConstructed())
352352 return;
353353
354 sys::SmartScopedLock Lock(&*LayoutLock);
354 sys::SmartScopedLock Lock(*LayoutLock);
355355 // Remove any layouts for this TD.
356356 LayoutInfoTy &TheMap = *LayoutInfo;
357357 for (LayoutInfoTy::iterator I = TheMap.begin(), E = TheMap.end(); I != E; ) {
368368 const StructLayout *TargetData::getStructLayout(const StructType *Ty) const {
369369 LayoutInfoTy &TheMap = *LayoutInfo;
370370
371 sys::SmartScopedLock Lock(&*LayoutLock);
371 sys::SmartScopedLock Lock(*LayoutLock);
372372 StructLayout *&SL = TheMap[LayoutKey(this, Ty)];
373373 if (SL) return SL;
374374
393393 void TargetData::InvalidateStructLayoutInfo(const StructType *Ty) const {
394394 if (!LayoutInfo.isConstructed()) return; // No cache.
395395
396 sys::SmartScopedLock Lock(&*LayoutLock);
396 sys::SmartScopedLock Lock(*LayoutLock);
397397 LayoutInfoTy::iterator I = LayoutInfo->find(LayoutKey(this, Ty));
398398 if (I == LayoutInfo->end()) return;
399399
306306 ConstantsLock->reader_release();
307307
308308 if (!Slot) {
309 sys::SmartScopedWriter Writer(&*ConstantsLock);
309 sys::SmartScopedWriter Writer(*ConstantsLock);
310310 ConstantInt *&NewSlot = (*IntConstants)[Key];
311311 if (!Slot) {
312312 NewSlot = new ConstantInt(ITy, V);
413413 ConstantsLock->reader_release();
414414
415415 if (!Slot) {
416 sys::SmartScopedWriter Writer(&*ConstantsLock);
416 sys::SmartScopedWriter Writer(*ConstantsLock);
417417 ConstantFP *&NewSlot = (*FPConstants)[Key];
418418 if (!NewSlot) {
419419 const Type *Ty;
12301230 /// getOrCreate - Return the specified constant from the map, creating it if
12311231 /// necessary.
12321232 ConstantClass *getOrCreate(const TypeClass *Ty, const ValType &V) {
1233 sys::SmartScopedLock Lock(&ValueMapLock);
1233 sys::SmartScopedLock Lock(ValueMapLock);
12341234 MapKey Lookup(Ty, V);
12351235 ConstantClass* Result = 0;
12361236
12481248 }
12491249
12501250 void remove(ConstantClass *CP) {
1251 sys::SmartScopedLock Lock(&ValueMapLock);
1251 sys::SmartScopedLock Lock(ValueMapLock);
12521252 typename MapTy::iterator I = FindExistingElement(CP);
12531253 assert(I != Map.end() && "Constant not found in constant table!");
12541254 assert(I->second == CP && "Didn't find correct element?");
13331333 }
13341334
13351335 void refineAbstractType(const DerivedType *OldTy, const Type *NewTy) {
1336 sys::SmartScopedLock Lock(&ValueMapLock);
1336 sys::SmartScopedLock Lock(ValueMapLock);
13371337 typename AbstractTypeMapTy::iterator I =
13381338 AbstractTypeMap.find(cast(OldTy));
13391339
17921792 static ManagedStatic > MDStringCache;
17931793
17941794 MDString *MDString::get(const char *StrBegin, const char *StrEnd) {
1795 sys::SmartScopedWriter Writer(&*ConstantsLock);
1795 sys::SmartScopedWriter Writer(*ConstantsLock);
17961796 StringMapEntry &Entry = MDStringCache->GetOrCreateValue(
17971797 StrBegin, StrEnd);
17981798 MDString *&S = Entry.getValue();
18031803 }
18041804
18051805 MDString *MDString::get(const std::string &Str) {
1806 sys::SmartScopedWriter Writer(&*ConstantsLock);
1806 sys::SmartScopedWriter Writer(*ConstantsLock);
18071807 StringMapEntry &Entry = MDStringCache->GetOrCreateValue(
18081808 Str.data(), Str.data() + Str.size());
18091809 MDString *&S = Entry.getValue();
18141814 }
18151815
18161816 void MDString::destroyConstant() {
1817 sys::SmartScopedWriter Writer(&*ConstantsLock);
1817 sys::SmartScopedWriter Writer(*ConstantsLock);
18181818 MDStringCache->erase(MDStringCache->find(StrBegin, StrEnd));
18191819 destroyConstantImpl();
18201820 }
18461846 ConstantsLock->reader_release();
18471847
18481848 if (!N) {
1849 sys::SmartScopedWriter Writer(&*ConstantsLock);
1849 sys::SmartScopedWriter Writer(*ConstantsLock);
18501850 N = MDNodeSet->FindNodeOrInsertPos(ID, InsertPoint);
18511851 if (!N) {
18521852 // InsertPoint will have been set by the FindNodeOrInsertPos call.
18581858 }
18591859
18601860 void MDNode::destroyConstant() {
1861 sys::SmartScopedWriter Writer(&*ConstantsLock);
1861 sys::SmartScopedWriter Writer(*ConstantsLock);
18621862 MDNodeSet->RemoveNode(this);
18631863
18641864 destroyConstantImpl();
27892789 Replacement = ConstantAggregateZero::get(getType());
27902790 } else {
27912791 // Check to see if we have this array type already.
2792 sys::SmartScopedWriter Writer(&*ConstantsLock);
2792 sys::SmartScopedWriter Writer(*ConstantsLock);
27932793 bool Exists;
27942794 ArrayConstantsTy::MapTy::iterator I =
27952795 ArrayConstants->InsertOrGetItem(Lookup, Exists);
28652865 Replacement = ConstantAggregateZero::get(getType());
28662866 } else {
28672867 // Check to see if we have this array type already.
2868 sys::SmartScopedWriter Writer(&*ConstantsLock);
2868 sys::SmartScopedWriter Writer(*ConstantsLock);
28692869 bool Exists;
28702870 StructConstantsTy::MapTy::iterator I =
28712871 StructConstants->InsertOrGetItem(Lookup, Exists);
241241 static ManagedStatic > GCLock;
242242
243243 bool Function::hasGC() const {
244 sys::SmartScopedReader Reader(&*GCLock);
244 sys::SmartScopedReader Reader(*GCLock);
245245 return GCNames && GCNames->count(this);
246246 }
247247
248248 const char *Function::getGC() const {
249249 assert(hasGC() && "Function has no collector");
250 sys::SmartScopedReader Reader(&*GCLock);
250 sys::SmartScopedReader Reader(*GCLock);
251251 return *(*GCNames)[this];
252252 }
253253
254254 void Function::setGC(const char *Str) {
255 sys::SmartScopedWriter Writer(&*GCLock);
255 sys::SmartScopedWriter Writer(*GCLock);
256256 if (!GCNamePool)
257257 GCNamePool = new StringPool();
258258 if (!GCNames)
261261 }
262262
263263 void Function::clearGC() {
264 sys::SmartScopedWriter Writer(&*GCLock);
264 sys::SmartScopedWriter Writer(*GCLock);
265265 if (GCNames) {
266266 GCNames->erase(this);
267267 if (GCNames->empty()) {
5353 // immediately, it is added to the CachedValue Value. If it is
5454 // immediately removed, no set search need be performed.
5555 void addGarbage(const T* o) {
56 sys::SmartScopedWriter Writer(&*LeakDetectorLock);
56 sys::SmartScopedWriter Writer(*LeakDetectorLock);
5757 if (Cache) {
5858 assert(Ts.count(Cache) == 0 && "Object already in set!");
5959 Ts.insert(Cache);
6262 }
6363
6464 void removeGarbage(const T* o) {
65 sys::SmartScopedWriter Writer(&*LeakDetectorLock);
65 sys::SmartScopedWriter Writer(*LeakDetectorLock);
6666 if (o == Cache)
6767 Cache = 0; // Cache hit
6868 else
7272 bool hasGarbage(const std::string& Message) {
7373 addGarbage(0); // Flush the Cache
7474
75 sys::SmartScopedReader Reader(&*LeakDetectorLock);
75 sys::SmartScopedReader Reader(*LeakDetectorLock);
7676 assert(Cache == 0 && "No value should be cached anymore!");
7777
7878 if (!Ts.empty()) {
232232 getPassRegistrar()->RegisterPass(*this);
233233
234234 // Notify any listeners.
235 sys::SmartScopedLock Lock(&ListenersLock);
235 sys::SmartScopedLock Lock(ListenersLock);
236236 if (Listeners)
237237 for (std::vector::iterator
238238 I = Listeners->begin(), E = Listeners->end(); I != E; ++I)
285285 // PassRegistrationListener ctor - Add the current object to the list of
286286 // PassRegistrationListeners...
287287 PassRegistrationListener::PassRegistrationListener() {
288 sys::SmartScopedLock Lock(&ListenersLock);
288 sys::SmartScopedLock Lock(ListenersLock);
289289 if (!Listeners) Listeners = new std::vector();
290290 Listeners->push_back(this);
291291 }
292292
293293 // dtor - Remove object from list of listeners...
294294 PassRegistrationListener::~PassRegistrationListener() {
295 sys::SmartScopedLock Lock(&ListenersLock);
295 sys::SmartScopedLock Lock(ListenersLock);
296296 std::vector::iterator I =
297297 std::find(Listeners->begin(), Listeners->end(), this);
298298 assert(Listeners && I != Listeners->end() &&
391391 if (dynamic_cast(P))
392392 return;
393393
394 sys::SmartScopedLock Lock(&*TimingInfoMutex);
394 sys::SmartScopedLock Lock(*TimingInfoMutex);
395395 std::map::iterator I = TimingData.find(P);
396396 if (I == TimingData.end())
397397 I=TimingData.insert(std::make_pair(P, Timer(P->getPassName(), TG))).first;
402402 if (dynamic_cast(P))
403403 return;
404404
405 sys::SmartScopedLock Lock(&*TimingInfoMutex);
405 sys::SmartScopedLock Lock(*TimingInfoMutex);
406406 std::map::iterator I = TimingData.find(P);
407407 assert(I != TimingData.end() && "passStarted/passEnded not nested right!");
408408 I->second.stopTimer();
10051005
10061006 // First, see if the type is already in the table, for which
10071007 // a reader lock suffices.
1008 sys::SmartScopedLock L(&*TypeMapLock);
1008 sys::SmartScopedLock L(*TypeMapLock);
10091009 ITy = IntegerTypes->get(IVT);
10101010
10111011 if (!ITy) {
10781078 FunctionValType VT(ReturnType, Params, isVarArg);
10791079 FunctionType *FT = 0;
10801080
1081 sys::SmartScopedLock L(&*TypeMapLock);
1081 sys::SmartScopedLock L(*TypeMapLock);
10821082 FT = FunctionTypes->get(VT);
10831083
10841084 if (!FT) {
11281128 ArrayValType AVT(ElementType, NumElements);
11291129 ArrayType *AT = 0;
11301130
1131 sys::SmartScopedLock L(&*TypeMapLock);
1131 sys::SmartScopedLock L(*TypeMapLock);
11321132 AT = ArrayTypes->get(AVT);
11331133
11341134 if (!AT) {
11871187 VectorValType PVT(ElementType, NumElements);
11881188 VectorType *PT = 0;
11891189
1190 sys::SmartScopedLock L(&*TypeMapLock);
1190 sys::SmartScopedLock L(*TypeMapLock);
11911191 PT = VectorTypes->get(PVT);
11921192
11931193 if (!PT) {
12491249 StructValType STV(ETypes, isPacked);
12501250 StructType *ST = 0;
12511251
1252 sys::SmartScopedLock L(&*TypeMapLock);
1252 sys::SmartScopedLock L(*TypeMapLock);
12531253 ST = StructTypes->get(STV);
12541254
12551255 if (!ST) {
13281328
13291329 PointerType *PT = 0;
13301330
1331 sys::SmartScopedLock L(&*TypeMapLock);
1331 sys::SmartScopedLock L(*TypeMapLock);
13321332 PT = PointerTypes->get(PVT);
13331333
13341334 if (!PT) {
14871487 void DerivedType::refineAbstractTypeTo(const Type *NewType) {
14881488 // All recursive calls will go through unlockedRefineAbstractTypeTo,
14891489 // to avoid deadlock problems.
1490 sys::SmartScopedLock L(&*TypeMapLock);
1490 sys::SmartScopedLock L(*TypeMapLock);
14911491 unlockedRefineAbstractTypeTo(NewType);
14921492 }
14931493
3636 std::string TypeSymbolTable::getUniqueName(const std::string &BaseName) const {
3737 std::string TryName = BaseName;
3838
39 sys::SmartScopedReader Reader(&*TypeSymbolTableLock);
39 sys::SmartScopedReader Reader(*TypeSymbolTableLock);
4040
4141 const_iterator End = tmap.end();
4242
4848
4949 // lookup a type by name - returns null on failure
5050 Type* TypeSymbolTable::lookup(const std::string& Name) const {
51 sys::SmartScopedReader Reader(&*TypeSymbolTableLock);
51 sys::SmartScopedReader Reader(*TypeSymbolTableLock);
5252
5353 const_iterator TI = tmap.find(Name);
5454 Type* result = 0;
133133 // This function is called when one of the types in the type plane are refined
134134 void TypeSymbolTable::refineAbstractType(const DerivedType *OldType,
135135 const Type *NewType) {
136 sys::SmartScopedReader Reader(&*TypeSymbolTableLock);
136 sys::SmartScopedReader Reader(*TypeSymbolTableLock);
137137
138138 // Loop over all of the types in the symbol table, replacing any references
139139 // to OldType with references to NewType. Note that there may be multiple
164164 // Loop over all of the types in the symbol table, dropping any abstract
165165 // type user entries for AbsTy which occur because there are names for the
166166 // type.
167 sys::SmartScopedReader Reader(&*TypeSymbolTableLock);
167 sys::SmartScopedReader Reader(*TypeSymbolTableLock);
168168 for (iterator TI = begin(), TE = end(); TI != TE; ++TI)
169169 if (TI->second == const_cast(static_cast(AbsTy)))
170170 AbsTy->removeAbstractTypeUser(this);
178178
179179 void TypeSymbolTable::dump() const {
180180 cerr << "TypeSymbolPlane: ";
181 sys::SmartScopedReader Reader(&*TypeSymbolTableLock);
181 sys::SmartScopedReader Reader(*TypeSymbolTableLock);
182182 for_each(tmap.begin(), tmap.end(), DumpTypes);
183183 }
184184
429429 if (VP->HasValueHandle) {
430430 // If this value already has a ValueHandle, then it must be in the
431431 // ValueHandles map already.
432 sys::SmartScopedReader Reader(&*ValueHandlesLock);
432 sys::SmartScopedReader Reader(*ValueHandlesLock);
433433 ValueHandleBase *&Entry = (*ValueHandles)[VP];
434434 assert(Entry != 0 && "Value doesn't have any handles?");
435435 AddToExistingUseList(&Entry);
441441 // reallocate itself, which would invalidate all of the PrevP pointers that
442442 // point into the old table. Handle this by checking for reallocation and
443443 // updating the stale pointers only if needed.
444 sys::SmartScopedWriter Writer(&*ValueHandlesLock);
444 sys::SmartScopedWriter Writer(*ValueHandlesLock);
445445 ValueHandlesTy &Handles = *ValueHandles;
446446 const void *OldBucketPtr = Handles.getPointerIntoBucketsArray();
447447
483483 // If the Next pointer was null, then it is possible that this was the last
484484 // ValueHandle watching VP. If so, delete its entry from the ValueHandles
485485 // map.
486 sys::SmartScopedWriter Writer(&*ValueHandlesLock);
486 sys::SmartScopedWriter Writer(*ValueHandlesLock);
487487 ValueHandlesTy &Handles = *ValueHandles;
488488 if (Handles.isPointerIntoBucketsArray(PrevPtr)) {
489489 Handles.erase(VP);