Skip to content

stdlib: check for ARM/ARM64/AArch64 more thoroughly #20709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/Runtime/Atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// is formally UB by C++11 language rules, we should be OK because neither
// the processor model nor the optimizer can realistically reorder our uses
// of 'consume'.
#if __arm64__ || __arm__
#if defined(__arm__) || defined(_M_ARM) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
# define SWIFT_MEMORY_ORDER_CONSUME (std::memory_order_relaxed)
#else
# define SWIFT_MEMORY_ORDER_CONSUME (std::memory_order_consume)
Expand Down
6 changes: 3 additions & 3 deletions stdlib/public/SwiftShims/HeapObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static_assert(alignof(HeapObject) == alignof(void*),
#define _swift_abi_ObjCReservedLowBits \
(unsigned) SWIFT_ABI_X86_64_OBJC_NUM_RESERVED_LOW_BITS

#elif defined(__arm64__)
#elif defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)

#ifdef __APPLE__
#define _swift_abi_LeastValidPointerValue \
Expand Down Expand Up @@ -165,10 +165,10 @@ static_assert(alignof(HeapObject) == alignof(void*),
#define _swift_abi_LeastValidPointerValue \
(__swift_uintptr_t) SWIFT_ABI_DEFAULT_LEAST_VALID_POINTER

#if __i386__
#if defined(__i386__)
#define _swift_abi_SwiftSpareBitsMask \
(__swift_uintptr_t) SWIFT_ABI_I386_SWIFT_SPARE_BITS_MASK
#elif __arm__
#elif defined(__arm__) || defined(_M_ARM)
#define _swift_abi_SwiftSpareBitsMask \
(__swift_uintptr_t) SWIFT_ABI_ARM_SWIFT_SPARE_BITS_MASK
#else
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/runtime/HeapObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ using namespace swift;
/// Returns true if the pointer passed to a native retain or release is valid.
/// If false, the operation should immediately return.
static inline bool isValidPointerForNativeRetain(const void *p) {
#if defined(__x86_64__) || defined(__arm64__)
#if defined(__x86_64__) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
// On these platforms, the upper half of address space is reserved for the
// kernel, so we can assume that pointer values in this range are invalid.
return (intptr_t)p > 0;
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/runtime/SwiftObject.mm
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ - (BOOL)isNSValue__ { return NO; }

#if defined(__x86_64__)
static uintptr_t const objectPointerIsObjCBit = 0x4000000000000000ULL;
#elif defined(__arm64__)
#elif defined(__arm64__) || defined(__arch64__) || defined(_M_ARM64)
static uintptr_t const objectPointerIsObjCBit = 0x4000000000000000ULL;
#else
static uintptr_t const objectPointerIsObjCBit = 0x00000002U;
Expand Down
8 changes: 4 additions & 4 deletions stdlib/public/runtime/WeakReference.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ class WeakReferenceBits {
#if !SWIFT_OBJC_INTEROP
NativeMarkerMask = 0,
NativeMarkerValue = 0
#elif __x86_64__
#elif defined(__x86_64__)
NativeMarkerMask = SWIFT_ABI_X86_64_OBJC_WEAK_REFERENCE_MARKER_MASK,
NativeMarkerValue = SWIFT_ABI_X86_64_OBJC_WEAK_REFERENCE_MARKER_VALUE
#elif __i386__
#elif defined(__i386__)
NativeMarkerMask = SWIFT_ABI_I386_OBJC_WEAK_REFERENCE_MARKER_MASK,
NativeMarkerValue = SWIFT_ABI_I386_OBJC_WEAK_REFERENCE_MARKER_VALUE
#elif __arm__
#elif defined(__arm__) || defined(_M_ARM)
NativeMarkerMask = SWIFT_ABI_ARM_OBJC_WEAK_REFERENCE_MARKER_MASK,
NativeMarkerValue = SWIFT_ABI_ARM_OBJC_WEAK_REFERENCE_MARKER_VALUE
#elif __arm64__
#elif defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
NativeMarkerMask = SWIFT_ABI_ARM64_OBJC_WEAK_REFERENCE_MARKER_MASK,
NativeMarkerValue = SWIFT_ABI_ARM64_OBJC_WEAK_REFERENCE_MARKER_VALUE
#else
Expand Down