This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Use the non-locking variant of objc_copyRealizedClassList
ClosedPublic

Authored by JDevlieghere on Jun 25 2021, 2:05 PM.

Details

Summary

Avoid standing the Objective-C runtime lock by calling objc_copyRealizedClassList_nolock instead of objc_copyRealizedClassList. We already guarantee that no other threads can run while we're running this utility expression, similar to when we parse the data ourself from the gdb_objc_realized_classes struct.

Diff Detail

Event Timeline

JDevlieghere requested review of this revision.Jun 25 2021, 2:05 PM
JDevlieghere created this revision.
jingham accepted this revision.Jun 25 2021, 2:19 PM

That seems fine to me. We already only allow one thread to run when we make this call, and copyRealizedClassList is read only, so at worst this will crash if the list is getting edited, but it won't do any harm and we'll just try again later. That's a much better failure mode than potentially stranding the ObjC runtime lock.

This revision is now accepted and ready to land.Jun 25 2021, 2:19 PM
This revision was landed with ongoing or failed builds.Jun 25 2021, 3:02 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 25 2021, 3:02 PM