Skip to content

Metadata cache optimizations #4582

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

Merged
merged 3 commits into from
Sep 1, 2016

Conversation

rjmccall
Copy link
Contributor

@rjmccall rjmccall commented Sep 1, 2016

This is a re-submission of #4428 with a fix for a longstanding bug in a particular type-metadata query that was exposed by these changes to metadata allocation.

be an ObjC class wrapper.

Fixes a longstanding bug that was exposed by my metadata cache improvements;
previously it was hidden due to a chain of coincidences around the
allocation of ObjCClassWrapper metadata.
no longer using it even in fallback code.
…urrentMap directly.

Previously, these were all using MetadataCache.  MetadataCache is a
more heavyweight structure which acquires a lock before building the
metadata.  This is appropriate if building the metadata is very
expensive or might have semantic side-effects which cannot be rolled
back.  It's also useful when there's a risk of re-entrance, since it
can diagnose such things instead of simply dead-locking or infinitely
recursing.  However, it's necessary for structural cases like tuple
and function types, and instead we can just use ConcurrentMap, which
does a compare-and-swap to publish the constructed metadata and
potentially destroys it if another thread successfully won the race.

This is an optimization which we could not previously attempt.

As part of this, fix tuple metadata uniquing to consider the label
string correctly.  This exposes a bug where the runtime demangling
of tuple metadata nodes doesn't preserve labels; fix this as well.
@rjmccall
Copy link
Contributor Author

rjmccall commented Sep 1, 2016

@swift-ci Please smoke test and merge.

@swift-ci swift-ci merged commit 65f6d9d into swiftlang:master Sep 1, 2016
@rjmccall rjmccall deleted the metadata-caching-redux branch September 1, 2016 03:19
kateinoigakukun added a commit that referenced this pull request Aug 31, 2022
[pull] swiftwasm from main
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.

2 participants