Skip to content

Commit 2ee68b9

Browse files
authored
Merge pull request swiftlang#33341 from mikeash/fix-isa-mask-assert2
[Runtime] Fix the isa mask assert for ARM64e.
2 parents ea30413 + e26aeca commit 2ee68b9

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

include/swift/Runtime/ObjCBridge.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ OBJC_EXPORT Class objc_readClassPair(Class cls,
6868
const struct objc_image_info *info)
6969
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
7070

71+
// Magic symbol whose _address_ is the runtime's isa mask.
72+
OBJC_EXPORT const struct { char c; } objc_absolute_packed_isa_class_mask;
73+
7174

7275
namespace swift {
7376

stdlib/public/runtime/SwiftObject.mm

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,9 @@ static id _getClassDescription(Class cls) {
198198

199199
@implementation SwiftObject
200200
+ (void)initialize {
201-
#if SWIFT_HAS_ISA_MASKING && !NDEBUG
202-
// Older OSes may not have this variable, or it may not match. This code only
203-
// runs on older OSes in certain testing scenarios, so that doesn't matter.
204-
// Only perform the check on newer OSes where the value should definitely
205-
// match.
206-
# if SWIFT_BUILD_HAS_BACK_DEPLOYMENT
207-
if (!_swift_isBackDeploying())
208-
# endif
209-
{
210-
assert(&objc_debug_isa_class_mask);
211-
assert(objc_debug_isa_class_mask == SWIFT_ISA_MASK);
212-
}
201+
#if SWIFT_HAS_ISA_MASKING && !TARGET_OS_SIMULATOR && !NDEBUG
202+
assert(&objc_absolute_packed_isa_class_mask);
203+
assert((uintptr_t)&objc_absolute_packed_isa_class_mask == SWIFT_ISA_MASK);
213204
#endif
214205
}
215206

0 commit comments

Comments
 (0)