Skip to content

Conversation

@adrian-prantl
Copy link

commit bf89718b096b1690037fb6e9b52c9ab65a1305d7
Author: Adrian Prantl <aprantl@apple.com>
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