Page MenuHomePhabricator

[lldb] Remove cache in get_demangled_name_without_arguments
ClosedPublic

Authored by teemperor on Tue, May 25, 11:34 AM.

Details

Summary

This function has a single-value caching based on function local static variables.

This causes two problems:

  • There is no synchronization, so this function randomly returns the demangled name of other functions that are demangled at the same time.
  • The 1-element cache is not very effective (the cache rate is around 0% when running the LLDB test suite that calls this function around 30k times).

I would propose just removing it.

To prevent anyone else the git archeology: the static result variables were originally
added as this returned a ConstString reference, but that has since been changed
so that this returns by value.

Diff Detail

Event Timeline

teemperor created this revision.Tue, May 25, 11:34 AM
teemperor requested review of this revision.Tue, May 25, 11:34 AM
teemperor edited the summary of this revision. (Show Details)
teemperor added inline comments.
lldb/source/Core/Mangled.cpp
38–39

I changed the name to reflect the code style. I'll do the same for the function above as a NFC follow up.

teemperor edited the summary of this revision. (Show Details)Tue, May 25, 11:38 AM
This revision is now accepted and ready to land.Tue, May 25, 12:41 PM
shafik accepted this revision.Tue, May 25, 3:33 PM
shafik added a subscriber: shafik.

was there a bug that inspired this?

was there a bug that inspired this?

Nope, the code just looked bogus when I scrolled over it while looking for something else.

This revision was landed with ongoing or failed builds.Wed, May 26, 9:28 AM
This revision was automatically updated to reflect the committed changes.