Skip to content
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

Don't trust the external cache when looking for field descriptors #68557

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

augusto2112
Copy link
Contributor

When looking for field descriptors for a typeref, we should iterate over every image info available, even those that the cache claimed to have processed, as a last ditch effort.

rdar://114567246

@augusto2112
Copy link
Contributor Author

@swift-ci test

for (size_t i = 0; i < ReflectionInfos.size(); ++i) {
if (ExternalTypeRefCache && ExternalTypeRefCache->isReflectionInfoCached(i))
continue;
if (auto FD = findFieldDescriptorAtIndex(i, *MangledName))
return *FD;
}

// If we still haven't found the field descriptor, go over every reflection
// info, even the ones the external cache supposedly processed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify whether this is intended as a workaround for a specific issue, or whether the contract for ExternalTypeRefCache is that it should only serve as a positive cache and not cache negative lookups?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial motivation was as a workaround to a specific bug, but I'm thinking that this should be the behavior even we solve the other bug. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either behavior is fine, I just wanted to make sure we explicitly document the contract in the code.

When looking for field descriptors for a typeref, we should iterate over
every image info available, even those that the cache claimed to have
processed, as a last ditch effort.

rdar://114567246
@augusto2112 augusto2112 merged commit 335648a into apple:rebranch Sep 19, 2023
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.

None yet

3 participants