forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 333
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
[cherry-pick][swift/release/6.0] [lldb][Type Completion] Lazy loading of C++ methods #8698
Merged
adrian-prantl
merged 10 commits into
swiftlang:swift/release/6.0
from
Michael137:lldb/type-completion/cherry-pick-all
May 6, 2024
Merged
[cherry-pick][swift/release/6.0] [lldb][Type Completion] Lazy loading of C++ methods #8698
adrian-prantl
merged 10 commits into
swiftlang:swift/release/6.0
from
Michael137:lldb/type-completion/cherry-pick-all
May 6, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note, this is a no-op when the LLDB setting `plugin.typesystem.clang.experimental-redecl-completion` is not set (which is currently the default). So this patch has no affect unless the user explicitly opts into it. The type-completion rework (aka redecl-completion) implemented in swiftlang#8222 comes with a large performance penalty, since we now eagerly complete `RecordType`s. Completing a `RecordType` previously unconditionally resolved all member function of said type. With redecl-completion completion, however, this meant we were now pulling in many more definitions than needed. Without redecl-completion, this isn't a problem, since importing method parameters is cheap (they are imported minimally), so we wouldn't notice that we always resolved all member functions. This patch tries to load methods lazily when in redecl-completion mode. We do this by introducing a new `ExternalASTSource::FindExternalVisibleMethods` API which Clang parses a member access expression. The callback into LLDB will do a `FindFunctions` call for all methods with the method name we're looking for, filters out any mismatches, and lets Clang continue with it's parsing. We still load following methods eagerly: 1. virtual functions: currently overrides are resolved in `CompleteRecordType` 2. operators: currently I couldn't find a point at which Clang can call into LLDB here to facilitate lazy loading 3. ctors/dtors: same reason as (2) In our benchmark harness, we saw this patch bring down redecl-completion expression evaluation on-par with top-of-tree expression evaluation. (cherry picked from commit ff8fdb9)
…lazy method loading (cherry picked from commit 4397f63)
(cherry picked from commit cd67c44)
…ompletion (cherry picked from commit c6a3b0e)
…is valid (cherry picked from commit 2a80d12)
… definition is not found (cherry picked from commit 44b5083)
…ource (cherry picked from commit a27eb1a)
…nt redecl-completion fixes These were fixed in swiftlang#8659. (cherry picked from commit 582bd6d)
We started hitting it after the fixes in swiftlang#8659. The assert can safely be disabled, so this patch does so to unblock CI. (cherry picked from commit 41754cd)
@swift-ci test |
Expected failures due to lazy method loading (swiftlang#8579) (cherry picked from commit 9507b8b)
Michael137
force-pushed
the
lldb/type-completion/cherry-pick-all
branch
from
May 6, 2024 09:00
f25ecc0
to
17fce6b
Compare
@swift-ci test |
adrian-prantl
approved these changes
May 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This cherry-picks all the commits associated with #8579