Skip to content

Commit 194d5d0

Browse files
committed
[Apple Silicon] Use a correct isa mask on Apple Silicon without signed isas
1 parent 710ba14 commit 194d5d0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

stdlib/public/runtime/Private.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,22 @@ class TypeInfo {
9696
// out the proper includes from libobjc. The values MUST match the ones from
9797
// libobjc. Debug builds check these values against objc_debug_isa_class_mask
9898
// from libobjc.
99-
# if TARGET_OS_SIMULATOR
100-
// Simulators don't currently use isa masking, but we still want to emit
99+
# if TARGET_OS_SIMULATOR && __x86_64__
100+
// Simulators don't currently use isa masking on x86, but we still want to emit
101101
// swift_isaMask and the corresponding code in case that changes. libobjc's
102102
// mask has the bottom bits clear to include pointer alignment, match that
103103
// value here.
104104
# define SWIFT_ISA_MASK 0xfffffffffffffff8ULL
105105
# elif __arm64__
106-
# define SWIFT_ISA_MASK 0x0000000ffffffff8ULL
106+
# if __has_feature(ptrauth_calls)
107+
# define SWIFT_ISA_MASK 0x007ffffffffffff8ULL
108+
# else
109+
# if TARGET_OS_OSX
110+
# define SWIFT_ISA_MASK 0x00007ffffffffff8ULL
111+
# else
112+
# define SWIFT_ISA_MASK 0x0000000ffffffff8ULL
113+
# endif
114+
# endif
107115
# elif __x86_64__
108116
# define SWIFT_ISA_MASK 0x00007ffffffffff8ULL
109117
# else

0 commit comments

Comments
 (0)