Skip to content

[5.1] [Runtime] Add caching based on ABI name to _findContextDescriptor. #26581

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

DougGregor
Copy link
Member

This is a one-to-many cache that's more speculative than the cache mapping mangled names to context descriptors. Entries found in the cache need to be verified for a match before they can be returned. However, this allows scanning conformance records up front and building up the cache in one scan rather than performing an expensive scan of all conformance records every time the mangled name cache misses.

rdar://problem/53560010

DougGregor and others added 8 commits August 5, 2019 22:12
…tensions

When looking for a context descriptor for a protocol extension, we
search based on the mangled name--"x", a generic type parameter with
depth and index 0--and are guaranteed to fail because there is no such
concrete type. However, _findContextDescriptor will fail very slowly,
spinning through all of the types and conformances in all of the
loaded images. Moreover, negative results aren't cached, so this can
happen repeatedly.

Short-circuit _findContextDescriptor when it receives a dependent
generic type parameter type, avoiding the expensive search when it
will find nothing.

Potential fix for rdar://problem/53560010.
This is a one-to-many cache that's more speculative than the cache mapping mangled names to context descriptors. Entries found in the cache need to be verified for a match before they can be returned. However, this allows scanning conformance records up front and building up the cache in one scan rather than performing an expensive scan of all conformance records every time the mangled name cache misses.

rdar://problem/53560010
@DougGregor DougGregor requested a review from a team as a code owner August 9, 2019 19:10
@DougGregor
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Aug 9, 2019

Build failed
Swift Test Linux Platform
Git Sha - f2f2c6e

@DougGregor
Copy link
Member Author

This doesn't look related at all:

/home/buildnode/jenkins/workspace/swift-PR-Linux/branch-swift-5.1-branch/tmp/TemporaryDirectory.AQQvUn/pkg/Package.swift:3:5: error: type annotation missing in pattern
13:29:59 let pack
13:29:59     ^

@DougGregor
Copy link
Member Author

@swift-ci please test Linux

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please test Linux

@DougGregor DougGregor merged commit 425a146 into swiftlang:swift-5.1-branch Aug 9, 2019
@DougGregor DougGregor deleted the runtime-find-context-descriptor-cache-5.1 branch August 9, 2019 22:51
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.

4 participants