This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Remove cache in get_demangled_name_without_arguments
ClosedPublic

Authored by teemperor on May 25 2021, 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.May 25 2021, 11:34 AM
teemperor requested review of this revision.May 25 2021, 11:34 AM
teemperor edited the summary of this revision. (Show Details)
teemperor added inline comments.
lldb/source/Core/Mangled.cpp
38

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)May 25 2021, 11:38 AM
This revision is now accepted and ready to land.May 25 2021, 12:41 PM
shafik accepted this revision.May 25 2021, 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.May 26 2021, 9:28 AM
This revision was automatically updated to reflect the committed changes.