Skip to content

Commit 7ae7cc5

Browse files
authored
Merge pull request #11976 from compnerd/llp64
runtime: make LLP64 clean
2 parents 3ad9504 + 635bb00 commit 7ae7cc5

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

include/swift/Runtime/Config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
/// According to the Objective-C ABI, this is true only for 64-bit
5555
/// platforms.
5656
#ifndef SWIFT_HAS_ISA_MASKING
57-
#if SWIFT_OBJC_INTEROP && defined(__LP64__)
57+
#if SWIFT_OBJC_INTEROP && __POINTER_WIDTH__ == 64
5858
#define SWIFT_HAS_ISA_MASKING 1
5959
#else
6060
#define SWIFT_HAS_ISA_MASKING 0

include/swift/Runtime/Metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ const ExtraInhabitantsValueWitnessTable METATYPE_VALUE_WITNESS_SYM(Bo); // Built
660660

661661
/// Return the value witnesses for unmanaged pointers.
662662
static inline const ValueWitnessTable &getUnmanagedPointerValueWitnesses() {
663-
#ifdef __LP64__
663+
#if __POINTER_WIDTH__ == 64
664664
return VALUE_WITNESS_SYM(Bi64_);
665665
#else
666666
return VALUE_WITNESS_SYM(Bi32_);

stdlib/public/SwiftShims/RefCount.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,14 +733,14 @@ class SideTableRefCountBits : public RefCountBitsT<RefCountNotInline>
733733
template <typename RefCountBits>
734734
class RefCounts {
735735
std::atomic<RefCountBits> refCounts;
736-
#if !__LP64__
736+
#if __POINTER_WIDTH__ == 32
737737
// FIXME: hack - something somewhere is assuming a 3-word header on 32-bit
738738
// See also other fixmes marked "small header for 32-bit"
739739
uintptr_t unused SWIFT_ATTRIBUTE_UNAVAILABLE;
740740
#endif
741741

742742
// Out-of-line slow paths.
743-
743+
744744
LLVM_ATTRIBUTE_NOINLINE
745745
void incrementSlow(RefCountBits oldbits, uint32_t inc);
746746

@@ -773,7 +773,7 @@ class RefCounts {
773773
// Refcount of a new object is 1.
774774
constexpr RefCounts(Initialized_t)
775775
: refCounts(RefCountBits(0, 1))
776-
#if !__LP64__ && !__has_attribute(unavailable)
776+
#if __POINTER_WIDTH__ == 32 && !__has_attribute(unavailable)
777777
, unused(0)
778778
#endif
779779
{ }

stdlib/public/runtime/ImageInspectionMachO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ constexpr const char TypeMetadataRecordSection[] = "__swift2_types";
3939
template<const char *SECTION_NAME,
4040
void CONSUME_BLOCK(const void *start, uintptr_t size)>
4141
void addImageCallback(const mach_header *mh, intptr_t vmaddr_slide) {
42-
#ifdef __LP64__
42+
#if __POINTER_WIDTH__ == 64
4343
using mach_header_platform = mach_header_64;
4444
assert(mh->magic == MH_MAGIC_64 && "loaded non-64-bit image?!");
4545
#else

stdlib/public/runtime/Metadata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ namespace {
11941194
uint32_t Flags;
11951195
uint32_t InstanceStart;
11961196
uint32_t InstanceSize;
1197-
#ifdef __LP64__
1197+
#if __POINTER_WIDTH__ == 64
11981198
uint32_t Reserved;
11991199
#endif
12001200
const uint8_t *IvarLayout;

stdlib/public/runtime/StaticBinaryELF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
using namespace std;
3838
using namespace llvm;
3939

40-
#ifdef __LP64__
40+
#if __POINTER_WIDTH__ == 64
4141
#define ELFCLASS ELFCLASS64
4242
typedef Elf64_Ehdr Elf_Ehdr;
4343
typedef Elf64_Shdr Elf_Shdr;

0 commit comments

Comments
 (0)