Skip to content

Commit cd46ead

Browse files
committed
Cache the last ObjC bridging conformance we looked up
1 parent 9d7f040 commit cd46ead

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/public/runtime/DynamicCast.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static std::atomic<ObjCBridgeWitnessCacheEntry> _objcBridgeWitnessCache = {};
215215

216216
static const _ObjectiveCBridgeableWitnessTable *
217217
findBridgeWitness(const Metadata *T) {
218-
auto cached = _objcBridgeWitnessCache.load(std::memory_order_relaxed);
218+
auto cached = _objcBridgeWitnessCache.load(SWIFT_MEMORY_ORDER_CONSUME);
219219
if (cached.metadata == T) {
220220
return cached.witness;
221221
}
@@ -226,7 +226,7 @@ findBridgeWitness(const Metadata *T) {
226226
.metadata = T,
227227
.witness = result
228228
};
229-
_objcBridgeWitnessCache.store(cached, std::memory_order_relaxed);
229+
_objcBridgeWitnessCache.store(cached, std::memory_order_release);
230230
return result;
231231
}
232232

0 commit comments

Comments
 (0)