Skip to content

[Cherry-pick into next] [lldb] Change LLDBTypeInfoProvider to a local (per-module) TypeSystemSwift #10380

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

Conversation

adrian-prantl
Copy link

commit bf89718b096b1690037fb6e9b52c9ab65a1305d7
Author: Adrian Prantl <[email protected]>
Date:   Fri Mar 28 13:34:44 2025 -0700

    [lldb] Change LLDBTypeInfoProvider to a local (per-module) TypeSystemSwift
    
    The decision of using a scratch context in TIP was made because
    reading types from a Process' reflection metadata can return types
    outside of the current lldb_private::Module. That'd be a huge problem
    for SwiftASTContext because it would pollute the context with ASTs
    from outside the Module, but TypeSystemSwiftTypeRef only deals in type
    names, which makes it immune to these risks.
    
    This change allows TypeAlias lookups to be made locally, which can
    dramatically speed up type resolution.  In a real-world benchmark of
    printing self in a large Swift/ObjC application the time spent in
    FindTypes() goes from 50% to it not even showing up on the profile.
    
    rdar://145884579

…Swift

The decision of using a scratch context in TIP was made because
reading types from a Process' reflection metadata can return types
outside of the current lldb_private::Module. That'd be a huge problem
for SwiftASTContext because it would pollute the context with ASTs
from outside the Module, but TypeSystemSwiftTypeRef only deals in type
names, which makes it immune to these risks.

This change allows TypeAlias lookups to be made locally, which can
dramatically speed up type resolution.  In a real-world benchmark of
printing self in a large Swift/ObjC application the time spent in
FindTypes() goes from 50% to it not even showing up on the profile.

rdar://145884579
(cherry picked from commit bf89718)
@adrian-prantl adrian-prantl merged commit e9dc5ef into swiftlang:next Mar 30, 2025
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