Runtime: Tighten up barriers in foreign type metadata.

When there's no init function, we can do relaxed loads and stores, because the metadata record will not change in the course of canonicalization. However, if there is initialization, we need to do a release-consume in order to ensure the initialization is visible to readers.

Swift SVN r23119
This commit is contained in:
Joe Groff
2014-11-05 19:16:10 +00:00
parent 63a429f16e
commit 763ce97193
2 changed files with 21 additions and 6 deletions

View File

@@ -2016,7 +2016,7 @@ static pthread_mutex_t ForeignTypesLock = PTHREAD_MUTEX_INITIALIZER;
static llvm::DenseMap<GlobalString, const ForeignTypeMetadata *> ForeignTypes;
const ForeignTypeMetadata *
swift::swift_getForeignTypeMetadata(ForeignTypeMetadata *nonUnique) {
swift::swift_getForeignTypeMetadata(ForeignTypeMetadata *nonUnique) {
// Fast path: check the invasive cache.
if (auto unique = nonUnique->getCachedUniqueMetadata()) {
return unique;