Skip to content

Commit 1a0c785

Browse files
authored
Merge pull request #24729 from mikeash/fix-isa-mask-assert
[Runtime] Don't check objc_debug_isa_class_mask when back deploying.
2 parents 22e5c55 + c42ec7a commit 1a0c785

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

stdlib/public/runtime/SwiftObject.mm

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,15 @@ Class _swift_classOfObjCHeapObject(OpaqueValue *value) {
195195

196196
@implementation SwiftObject
197197
+ (void)initialize {
198-
#if SWIFT_HAS_ISA_MASKING
199-
// Really old ObjC runtimes don't have this symbol, which is OK. If
200-
// the symbol exists, then our value must match.
201-
assert(&objc_debug_isa_class_mask == NULL ||
202-
objc_debug_isa_class_mask == SWIFT_ISA_MASK);
198+
#if SWIFT_HAS_ISA_MASKING && !NDEBUG
199+
// Older OSes may not have this variable, or it may not match. This code only
200+
// runs on older OSes in certain testing scenarios, so that doesn't matter.
201+
// Only perform the check on newer OSes where the value should definitely
202+
// match.
203+
if (!_swift_isBackDeploying()) {
204+
assert(&objc_debug_isa_class_mask);
205+
assert(objc_debug_isa_class_mask == SWIFT_ISA_MASK);
206+
}
203207
#endif
204208
}
205209

0 commit comments

Comments
 (0)