This is an archive of the discontinued LLVM Phabricator instance.

SymbolVendor: Move locking into the Symbol Files
ClosedPublic

Authored by labath on Jul 26 2019, 5:00 AM.

Details

Summary

The last bit of functionality in SymbolVendor passthrough functions is
the locking the module mutex. While it may be nice doing the locking in
a central place, we weren't really succesful in doing that right now,
because some SymbolFile function could still be called without going
through the SymbolVendor. This meant in SymbolFileDWARF (the only
battle-tested symbol file implementation) roughly a half of the
functions was taking additional locks and another half was asserting
that the lock is already held. By making the SymbolFile responsible for
locking, we can at least make the situation in SymbolFileDWARF more
consistent.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Jul 26 2019, 5:00 AM
clayborg accepted this revision.Jul 29 2019, 11:03 AM
This revision is now accepted and ready to land.Jul 29 2019, 11:03 AM

We will need to watch future submissions closely as this increases the chance that someone will extend a SymbolFile by overriding a virtual function and forget to lock.

JDevlieghere accepted this revision.Jul 29 2019, 3:30 PM

We will need to watch future submissions closely as this increases the chance that someone will extend a SymbolFile by overriding a virtual function and forget to lock.

I've though about addressing that by moving the actual implementations into private versions of these functions, and putting the locking into public functions which would just take the lock and then call the private version (essentially doing the same thing as it's done now, only without the methods being on different classes). I didn't do that now because:
a) it wouldn't make SymbolFileDWARF consistent anyway as it already has private methods which take the module lock
b) it forces a certain locking pattern on all the subclasses, whereas some subclasses could potentially want to implement a different locking strategy

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2019, 1:22 AM