This is an archive of the discontinued LLVM Phabricator instance.

tsan: refactor MetaMap::GetAndLock interface
ClosedPublic

Authored by dvyukov on Aug 2 2021, 2:08 AM.

Details

Summary

Don't lock the sync object inside of MetaMap methods.
This has several advantages:

  • the new interface does not confuse thread-safety analysis so we can remove a bunch of NO_THREAD_SAFETY_ANALYSIS attributes
  • this allows use of scoped lock objects
  • this allows more flexibility, e.g. locking some other mutex between searching and locking the sync object

Also prefix the methods with GetSync to be consistent with GetBlock method.
Also make interface wrappers inlinable, otherwise we either end up with
2 copies of the method, or with an additional call.

Diff Detail

Event Timeline

dvyukov created this revision.Aug 2 2021, 2:08 AM
dvyukov requested review of this revision.Aug 2 2021, 2:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2021, 2:08 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
melver accepted this revision.Aug 2 2021, 3:27 AM
This revision is now accepted and ready to land.Aug 2 2021, 3:27 AM
This revision was landed with ongoing or failed builds.Aug 2 2021, 4:29 AM
This revision was automatically updated to reflect the committed changes.