This is an archive of the discontinued LLVM Phabricator instance.

[lldb][NFC] Remove ThreadSafeSTLVector and ThreadSafeSTLMap and their use in ValueObjectSynthetic
ClosedPublic

Authored by teemperor on Nov 29 2019, 2:58 AM.

Details

Summary

ThreadSafeSTLVector and ThreadSafeSTLMap are not useful for achieving any degree of thread safety in LLDB
and should be removed before they are used in more places. They are only used (unsurprisingly incorrectly) in
ValueObjectSynthetic::GetChildAtIndex, so this patch replaces their use there with a simple mutex with which
we guard the related data structures. This doesn't make ValueObjectSynthetic::GetChildAtIndex
any more thread-safe, but on the other hand it at least allows us to get rid of the ThreadSafeSTL* data structures
without changing the observable behaviour of ValueObjectSynthetic (beside that it is now a few bytes smaller).

Diff Detail

Event Timeline

teemperor created this revision.Nov 29 2019, 2:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 29 2019, 2:58 AM
labath accepted this revision.Nov 29 2019, 5:06 AM

I'm yet to see a non-trivial algorithm, which can be made thread-safe by employing "thread safe" containers. +1 for deleting these and sorting the ValueObjectSynthetic issues later.

This revision is now accepted and ready to land.Nov 29 2019, 5:06 AM
This revision was automatically updated to reflect the committed changes.
lldb/include/lldb/Core/ThreadSafeSTLMap.h