mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user