Skip to content

Cherrypick upstream demangling commits #3902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 8, 2022
Merged

Conversation

JDevlieghere
Copy link

No description provided.

Have the different ::Parse.* methods return the demangled string
directly instead of having to go through ::GetBufferRef.

Differential revision: https://reviews.llvm.org/D118953

(cherry picked from commit fa52788)
…l table

The symbol table needs to demangle all symbol names when building its
index. However, this doesn't require the full mangled name: we only need
the base name and the function declaration context. Currently, we always
construct the demangled string during indexing and cache it in the
string pool as a way to speed up future lookups.

Constructing the demangled string is by far the most expensive step of
the demangling process, because the output string can be exponentially
larger than the input and unless you're dumping the symbol table, many
of those demangled names will not be needed again.

This patch avoids constructing the full demangled string when we can
partially demangle. This speeds up indexing and reduces memory usage.

I gathered some numbers by attaching to Slack:

Before
------

  Memory usage: 280MB
  Benchmark 1: ./bin/lldb -n Slack -o quit
    Time (mean ± σ):      4.829 s ±  0.518 s    [User: 4.012 s, System: 0.208 s]
    Range (min … max):    4.624 s …  6.294 s    10 runs

After
-----

  Memory usage: 189MB
  Benchmark 1: ./bin/lldb -n Slack -o quit
    Time (mean ± σ):      4.182 s ±  0.025 s    [User: 3.536 s, System: 0.192 s]
    Range (min … max):    4.152 s …  4.233 s    10 runs

Differential revision: https://reviews.llvm.org/D118814

(cherry picked from commit aed965d)
This addresses Pavel's comment from D118814.

(cherry picked from commit edbb0f6)
@JDevlieghere
Copy link
Author

@swift-ci please test

After aed965d we no longer demangle full symbol names while indexing the
symbol table which means we have to use the mangled name instead of the
demangled name to find the symbol for __asan::AsanDie().

This fixes the following two tests:

  lldb-api :: functionalities/asan/TestMemoryHistory.py
  lldb-api :: functionalities/asan/TestReportData.py

(cherry picked from commit ef3fade)
@JDevlieghere
Copy link
Author

@swift-ci please test

1 similar comment
@JDevlieghere
Copy link
Author

@swift-ci please test

@JDevlieghere
Copy link
Author

@swift-ci please test linux platform

1 similar comment
@JDevlieghere
Copy link
Author

@swift-ci please test linux platform

@JDevlieghere JDevlieghere merged commit 2d5fab8 into stable/20211026 Feb 8, 2022
@JDevlieghere JDevlieghere deleted the demangling branch February 8, 2022 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant